user1994660 user1994660 - 6 months ago 83
PHP Question

Is it possible to load doctrine fixtures without deleting database

I have defined some

fixtures
in
doctrine
.

When i try to run using this

php app/console doctrine:fixtures:load
then it asks me to purge the database.

is it possible to load it without purging database.

I remeber
Django
has
fixtures
which can be loaded in separate tables without purging existing database

Answer

Use the --append option

php app/console help doctrine:fixtures:load
Usage:
 doctrine:fixtures:load [--fixtures[="..."]] [--append] [--em="..."] [--purge-with-truncate]

Options:
 --fixtures             The directory or file to load data fixtures from. (multiple values allowed)
 --append               Append the data fixtures instead of deleting all data from the database first.
 --em                   The entity manager to use for this command.
 --purge-with-truncate  Purge data by using a database-level TRUNCATE statement