doctrine / DoctrineFixturesBundle

Symfony integration for the doctrine/data-fixtures library
MIT License
2.45k stars 202 forks source link

How do I access existing data in the database in a fixture? #331

Closed ChangePlaces closed 3 years ago

ChangePlaces commented 3 years ago

I have a basic core of data that I'm inserting in a migration, and using fixtures to insert additional data for development. How do I access existing data in the database for setting in relationships? I've tried $manager->find($class,$id), createquerybuilder, injecting an EntityManagerInterface and using that connection with a querybuilder, and ManagerRegistry all giving null when the data exists.

ChangePlaces commented 3 years ago

You know, fixtures clear the database before running... unless --append is used!