I found in Symfony docs that you can Generate Entities from an Existing Database so are there any ways to update entities from existing database I added using MySQL?
For example, I added new column to my FOSUSERBUNDLE database called "batman"
using this command on MySQL:
ALTER TABLE cs_symfony_members
ADD batman int(11) NOT NULL;
how to update my entities i generated using the docs guide above ?
If you need to update database schema to Entity, you can use two command:
(1) Create entity mapping from database:
bin/console doctrine:mapping:import BundleName --filter=EntityName
(2) Update your entity to match this mapping:
bin/console doctrine:generate:entities BundleName:EntityName
Example, I have a User table in database, a had changed structure of this table. And now, I want to update these changes to my User entity in AppBundle. I need to run following command:
bin/console doctrine:mapping:import AppBundle --filter=User
bin/console doctrine:generate:entities AppBundle:User
I hope this can help you!