Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DriverFactory doesn't work with Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain #31

Closed
MuntzMathias opened this issue Jul 14, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@MuntzMathias
Copy link

Hello

I'm switching between the repository of Dasprid and that of Roave.
I have the following configuration for the configuration of my entityManager.

use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;

return [
    'driver' => [
        'domain' => [
            'class' => MappingDriverChain::class,
            'drivers' => [
                'Domain' => 'domain_entity'
            ],
        ],
        'domain_entity' => [
            'class' => XmlDriver::class,
            'paths' => __DIR__ . '/../src/Infrastructure/Mapping',
        ]
    ]
];

When I instantiate the entityManager I get the following error: (For information it worked correctly with Dasprid services)
The class 'Domain\Account\Entity\User' was not found in the chain configured namespaces.

If I understand correctly, the problem comes from the Factory DriverFactory
which tests if the driver and type is an instance Doctrine\Persistence\Mapping\Driver\MappingDriverChain and not an instance of Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain as described in the example of minimal configuration

Except I do not use the Doctrine\Persistence library, it is also not required in the composer.
So, what should I do ? Install 'Doctrine\Persistence' and use it in my configuration ?

Thank you in advance for your help.

@MuntzMathias MuntzMathias changed the title Driver Factory doesn't work with Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain DriverFactory doesn't work with Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain Jul 14, 2020
@asgrim
Copy link
Member

asgrim commented Jul 14, 2020

IIRC, this changed because MappingDriverChain changed namespace; I think the solution is indeed to add doctrine/persistence, but without investigating further I don't know why it wouldn't already be required (maybe do a composer update --with(-all)-dependencies to pick it up?).

The example definitely needs updating though, so that needs updating.

@asgrim asgrim added the documentation Improvements or additions to documentation label Jul 14, 2020
@MuntzMathias
Copy link
Author

Thank you for the answer. Indeed, I cleaned up my composer.json, it contained a dependency on doctrine/orm:^2.7.
I deleted it and completely recreated the vendor, it installed the doctrine/persistence package.
I use it now in my configuration file and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants