Generating CRUD based on Doctrine Entity using Symfony2
Suresh Raj Bhattarai
1:39 AM
In MySql database
Initially make sure you have your database created on the mysql.
Create a table product on that database and create the fields for the product table.
In Git Bash
We assume that you are in your project root directory
Initially make sure you have your database created on the mysql.
Create a table product on that database and create the fields for the product table.
In Git Bash
We assume that you are in your project root directory
Run the following command to create crud controller
php app/console generate:doctrine:crud
This will help you list the records, add records, edit records and delete records.
Entity shortcut name: AcmeDemoBundle:Product
If you want to create write action (means if you want to create/edit/delete record), then you have enter yes
Configuration format: yml
Routes prefix [/product] : Press Enter to give the routing prefix as it is.
Do you confirm generation: Press Enter to confirm.
Confirm automatic update of routing? Press Enter to confirm.
This will create CRUD controller.
Once a controller is created, if you want to overwrite any of the things to the existing controller, then run the following command.
php app/console generate:doctrine:crud --overwrite
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment