You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Out of the box, we use Phinx like detailed above to populate the database. Doctrine is an alternative that is also ready to use for new migrations. An example file is included in `/data/doctrine/migrations`, but it's empty, so it won't run any queries. It can be edited freely. To generate a new migration file, use this command
144
+
Out of the box, we use Doctrine Migrations like detailed below to populate the database. An example file is included in `/data/doctrine/migrations`. To generate a new migration file, use this command:
This will also remove the log for that migration in the database, allowing the migration to run again with `php vendor/bin/doctrine-migrations migrate`.
193
185
Note the `20220606131835` is taken from the migration filename, e.g. `Version20220606131835.php`
194
186
187
+
## Seeding the database (Fixtures)
188
+
Seeding the database is done with the help of our custom package ``dotkernel/dot-data-fixtures`` built on top of doctrine/data-fixtures. See below on how to use our CLI command for listing and executing Doctrine data fixtures.
189
+
190
+
An example of a fixtures class is ``data/doctrine/fixtures/RoleLoader.php``
191
+
192
+
Running ``php bin/doctrine fixtures:list`` will list all the available fixtures, by order of execution.
193
+
194
+
To execute all fixtures run : ``php bin/doctrine fixtures:execute``.
195
+
196
+
To execute a specific fixtures run : ``php bin/doctrine fixtures:execute --class=RoleLoader``
197
+
198
+
Fixtures can and should be ordered to ensure database consistency, more on ordering fixtures can be found here :
- If you use `composer create-project`, the project will go into development mode automatically after installing. The development mode status can be checked and toggled by using these composer commands
0 commit comments