Entities and Migrations¶
All entities are stored in
app/Entities under the
app\Entities namespace, some of these entities are in nested namespaces where they are
more specific to different areas of the system.
Whe making any changes to Doctrine definitions you will need to generate a new migration and then commit that migration before the changes will be reflected. All migrations generated by Doctrine can be reversed and stepped through as needed, it is recommended that migrations be squashed after a feature is complete in to one migration to better manage versions.
Once an entity is updated to generate a migration:
php artisan doctrine:migrations:diff
This command will do a diff against the current state of the database and create the changes in a Doctrine migration file located in:
To commit this migration to the database:
php artisan doctrine:migrations:migrate
This will bring you to the latest available migration.
Following on from this, regenerate the Doctrine entity proxy objects (used for lazy loading)
php artisan doctrine:generate:proxies
!! Note Doctrine proxies are NOT versioned at this moment in time as they polluted git commits, this will need to be changed to prevent issues when deploying to production in the future.
1 2 3