doctrine-ormsymfony4fixturessymfony-console

How to exclude some tables to be purged in DoctrineFixtures in Symfony 4?


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?


Solution

  • 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