Reputation: 1057
How can we exclude some tables (for example, country, city, etc) to be purged via doctrine:fixtures:load? Is there any yaml configuration file or sth else?
Upvotes: 1
Views: 2450
Reputation: 670
Yes, such options was implemented recently in https://github.com/doctrine/DoctrineFixturesBundle/pull/307
You could use --purge-exclusions
option now. Enjoy!
E.g.
php bin/console doctrine:fixtures:load --no-interaction --env=test --purge-exclusions=regions --purge-exclusions=countries
You could read to how customize purging behaviour https://symfony.com/doc/3.1/bundles/DoctrineFixturesBundle/index.html#specifying-purging-behavior
Be attention that this feature is available only since 3.4.0
release https://github.com/doctrine/DoctrineFixturesBundle/releases/tag/3.4.0
Upvotes: 3
Reputation: 137
php bin/console doctrine:fixtures:load --append
By default the load command purges the database, removing all data from every table. To append your fixtures' data add the --append option.
Source: Symfony Documentation
Upvotes: 0