doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.76k stars 224 forks source link

Use of ObjectManager->getClassMetadata on the className in ReferenceRepository methods breaks expected behaviour #426

Open hitsuji opened 1 year ago

hitsuji commented 1 year ago

Symfony Documentation suggests Fixtures can share any PHP object between each other using the addReference and getReference methods. https://symfony.com/bundles/DoctrineFixturesBundle/current/index.html#sharing-objects-between-fixtures

However, tracing through these calls through to the ReferenceRepository, both will eventually call ObjectManager->getClassMetadata which will require the classes namespace to be configure in the ORM EntityManager, otherwise throwing an error.

So attempting to store an stdClass will throw an error similar to: The class 'stdClass' was not found in the chain configured namespaces App\Entity.

Either Documentation needs to be corrected or the behavior needs to be corrected.