skar / laminas-doctrine-orm

Simple Laminas/Mezzio Doctrine ORM integration
BSD 3-Clause "New" or "Revised" License
12 stars 5 forks source link

TypeError in the DriverFactory when use AttributeDriver #2

Closed artemmolotov closed 3 years ago

artemmolotov commented 3 years ago

Bug Report

Q A
Version(s) v0.1

Summary

When I use \Doctrine\ORM\Mapping\Driver\AttributeDriver, I get an error:

Uncaught TypeError: Doctrine\ORM\Mapping\Driver\AttributeDriver::__construct(): Argument # 1 ($paths) must be of type array, Doctrine\Common\Annotations\CachedReader given, called in ... vendor\skar\laminas-doctrine-orm\src\Service\DriverFactory.php on line 49...

How to reproduce

  1. 
    // config/autoload/orm.global.php

<?php

declare(strict_types=1);

return [ 'doctrine' => [ 'connection' => [ 'orm_default' => [ 'driver_class' => \Doctrine\DBAL\Driver\PDO\MySQL\Driver::class, ], ], ], ];

2. 
```php
// local.php

<?php

/**
 * Local configuration.
 *
 * Copy this file to `local.php` and change its settings as required.
 * `local.php` is ignored by git and safe to use for local and sensitive data like usernames and passwords.
 */

declare(strict_types=1);

return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'params' => [
                    'host'     => '<host>',
                    'port'     => '<port>',
                    'user'     => '<user>',
                    'password' => '<pass>',
                    'dbname'   => '<dbname>',
                ],
            ],
        ],
    ],
];
  1. Run vendor/bin/laminas doctrine:migrations:diff
skar commented 3 years ago

Thanks! Maybe this part should be rewritten in the future, but for now this should work.