Two days of contact found Symfony really pretty cow broke, before the tangled Laravel or symfony which a good point, learned laravel one weeks found that the document learning material is too little, and immediately turned to Symfony found him and laravle function almost, So the laravle that I had seen one weeks ago didn't look white. But today found a very good function, more Java almost, happy for a while, the following to share, how to like Java automatically a few clicks, automatically generated the database table entity
I am using symfony3.0, generate database Entity positive Connection database configuration information, connection configuration information in the App/config/parameters.yml file Symfony will automatically identify what database, want to study carefully to read the document it! said the document I am also drunk, a word a word copy to Baidu translation inside understand meaning.
Generating entities from a database table
1. Generated by the database model: 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"
(The model to change the first line of the path, or in the instance table structure will be error as follows:)
Invalid mapping file ' AppBundle.Entity.AppUser.orm.yml ' for class ' Appbundle\entity\appuser '. Example:app_ The model of the user table generates the first behavior: ' Appuser: '; To change this to "Appbundle\entity\appuser:" Fish 2. Instance All table structure table structure file copied to: Appbundle\resources\config \doctrine php bin/console doctrine:generate:entities appbundle/entity/--path src/Instance single table structure (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): Turn on database migration: Composer require doctrine/doctrine-migrations-bundle "^1.0" entity update to Database resources->entity (Compare) PHP bin/console Doctrine:migrations:diff (migration) PHP bin/console doctrine:migrations:migrate