Symfony 7 cheatsheet
Symfony 7: Database (Doctrine)
7 common Symfony 7 tasks.
Generate a migration
Create a migration from the differences between entities and the database.
php bin/console make:migration
Run migrations
Apply pending migrations.
php bin/console doctrine:migrations:migrate
Caution: Check the migration's SQL and back up production data before running it.
Check migration status
Show applied and pending migrations.
php bin/console doctrine:migrations:status
Validate the mapping
Check that the mapping is valid and the database is in sync.
php bin/console doctrine:schema:validate
Run a SQL query
Run a query against the configured database.
php bin/console dbal:run-sql "SELECT * FROM product"
Load fixtures
Load sample data. Needs doctrine/doctrine-fixtures-bundle.
php bin/console doctrine:fixtures:load
Caution: Purges the database before loading unless you pass --append.