doctrine / DoctrineMongoDBBundle

Integrates Doctrine MongoDB ODM with Symfony
http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html
MIT License
382 stars 230 forks source link

Unique validator #689

Closed fraynaud1330 closed 3 years ago

fraynaud1330 commented 3 years ago

Hello

My application is on the version 4.3.0 of doctrine/mongodb-odm-bundle.

I have an issue with the unique constraint (Doctrine\Bundle\MongoDBBundle\Validator\Constraints\Unique) when I upgrade from symfony/doctrine-bridge 5.2.10 to 5.2.12. I am using the annotation to use the unique constraint.

Here is the error :

TypeError: Argument 1 passed to Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator::formatWithIdentifiers() must implement interface Doctrine\ORM\EntityManagerInterface, instance of Doctrine\ODM\MongoDB\DocumentManager given, called in /srv/api/vendor/symfony/doctrine-bridge/Validator/Constraints/UniqueEntityValidator.php on line 173

/srv/api/vendor/symfony/doctrine-bridge/Validator/Constraints/UniqueEntityValidator.php:180 /srv/api/vendor/symfony/doctrine-bridge/Validator/Constraints/UniqueEntityValidator.php:173 /srv/api/vendor/symfony/validator/Validator/RecursiveContextualValidator.php:759 /srv/api/vendor/symfony/validator/Validator/RecursiveContextualValidator.php:488 /srv/api/vendor/symfony/validator/Validator/RecursiveContextualValidator.php:313 /srv/api/vendor/symfony/validator/Validator/RecursiveContextualValidator.php:138 /srv/api/vendor/symfony/validator/Validator/RecursiveValidator.php:93 /srv/api/vendor/symfony/validator/Validator/TraceableValidator.php:66 /srv/api/vendor/api-platform/core/src/Bridge/Symfony/Validator/Validator.php:67 /srv/api/vendor/api-platform/core/src/Validator/EventListener/ValidateListener.php:68 /srv/api/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117 /srv/api/vendor/symfony/event-dispatcher/EventDispatcher.php:230 /srv/api/vendor/symfony/event-dispatcher/EventDispatcher.php:59 /srv/api/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151 /srv/api/vendor/symfony/http-kernel/HttpKernel.php:162 /srv/api/vendor/symfony/http-kernel/HttpKernel.php:79 /srv/api/vendor/symfony/http-kernel/Kernel.php:195 /srv/api/vendor/symfony/http-kernel/HttpKernelBrowser.php:65 /srv/api/vendor/symfony/framework-bundle/KernelBrowser.php:169 /srv/api/vendor/symfony/browser-kit/AbstractBrowser.php:384 /srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/Client.php:124 /srv/api/tests/Functional/FunctionnalTestCase.php:277 /srv/api/tests/Functional/FunctionnalTestCase.php:207 /srv/api/tests/Functional/FunctionnalTestCase.php:146 /srv/api/tests/Functional/HttpMethodTestTrait/Post409TestTrait.php:22

I don't if I should put this comment here or in the Symfony project.

malarzm commented 3 years ago

@fraynaud1330 thanks for the report! I've created https://github.com/symfony/symfony/pull/42360 on Symfony's end as that's where the BC break is coming from. Closing as there's nothing more we can do on our end :)