Reputation: 1547
I need to edit my entity to have a couple more values. I have already generate crud with my earlier values. How do I regenerate crud via app/console after editing the entity so that it automatically makes functions for the other values.
Upvotes: 3
Views: 2382
Reputation: 94
to update generated CRUD you can use --overwrite.
php app/console generate:doctrine:crud bundle:Entity --overwrite
Upvotes: 3
Reputation: 1754
To do this you need to delete the controller, the views and the form that was generated for this crud. Then you can just regenerate from scratch. Be cautious with this approach though, as you will obviously lose any customisation you have made to any of those files. I would only do this if I had not made any changes to the controller, form or templates. Otherwise you should just manually add the new fields to your form and your views.
EDIT: If you are new to Symfony then I would recommend adding the data manually anyway to get a feel for how it works.
EDIT2: Just to clarify for you. The reason the command doesn't automatically update all of the views etc... is for the exact reason I mentioned above. It's to stop ou automatically overwriting any custom modifications you have made. Typically, the crud will just be generated as a starting point and then all future changes will be added manually.
Upvotes: 4