Import data instead of loading fixtures #2
-
cool utility. I've played around with the Symfony serializer and haven't quite got it yet, but this seems pretty similar -- pass it an array and the object get populated and persisted. I'd like to use this as an import tool rather than a fixture loader, and I'm wondering if that's possible. bin/console data:import ProductFixtures --overwrite My idea is that the class would implement ArrayFixture, and it would populate the entities (skipping existing ones unless --overwrite or --force was set). But I'll certainly use this for fixtures as well -- especially since I'm using SmokeTest more! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Import tools work differently because they need the data to be 100% valid. Fixtures could be executed without validation and the only constraints would be database-wise, that's the reason why it's mostly dedicated to populate default data for testing purposes. |
Beta Was this translation helpful? Give feedback.
Import tools work differently because they need the data to be 100% valid. Fixtures could be executed without validation and the only constraints would be database-wise, that's the reason why it's mostly dedicated to populate default data for testing purposes.