Symfony database tables generate entities, migrate databases, and symfony entities
Generate entities from the database table 1. model generated by the database: php bin/console doctrine: mapping: convert -- from-database yml D: \ db \
D:\test_backend>php bin/console doctrine:mapping:convert --from-database yml D:\db\Processing entity "AppUser"Processing entity "Channel"Processing entity "MigrationVersions"Exporting "yml" mapping information to "D:\db"
(To change the path of the first line of the model, otherwise an error will be reported in the instance table structure as follows :)
Invalid mapping file 'appbundle. entity. appUser. orm. yml for class 'appbundle \ Entity \ appuser '. example: The first behavior of the model generated by the app_user table: 'appuser: '; to change this behavior to "AppBundle \ Entity \ AppUser:"-> two subfish 2. copy all table structure file of the instance to: AppBundle \ Resources \ config \ doctrine php bin/console doctrine: generate: entities AppBundle/Entity/-- path src/single table structure of the Instance (SiteChannel) php bin/console doctrine: generate: entities AppBundle/Entity/SiteChannel -- path src/
D:\test_backend>php bin/console doctrine:generate:entities AppBundle/Entity/AppUser --path src/Generating entities for namespace "AppBundle\Entity\AppUser" > backing up AppUser.php to AppUser.php~ > generating AppBundle\Entity\AppUser
Database migration (symfony local migration to database): Enable database migration: composer require doctrine/doctrine-migrations-bundle "^ 1.0" Entity update to database Resources-> Entity (comparison) php bin/console doctrine: migrations: diff (Migration) php bin/console doctrine: migrations: migrate-> mongoshake