Created
July 26, 2014 14:57
-
-
Save fredmontet/c994b80fc52b3e63d881 to your computer and use it in GitHub Desktop.
Add a column to an existing table in Symfony 2.3 with Doctrine 2.3 and MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL: http://stackoverflow.com/questions/14941358/add-a-column-to-an-existing-entity-in-symfony | |
Download the Doctrine Migrations package (http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html). | |
modify the class by: | |
Acme\MyBundle\Entity\Customer and add the property you want: | |
Acme\MyBundle\Entity\Customer | |
or modify the doctrine file: | |
Acme/MyBundle/Resources/config/doctrine/customer.yml | |
run the console command (it will add the proper set/get in the class) | |
php app/console doctrine:generate:entities AcmeMyBundle:Customer | |
run the console command | |
php app/console doctrine:migrations:diff | |
run the console command (it will place a new file on app/DoctrineMigrations) | |
php app/console doctrine:migrations:migrate | |
When you're deploying the new version of the code, all you got to do is update the source code and run the command above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment