Simple CRUD
Here we are showcasing how to make a simple CRUD operation using symfony core PHP application development framework. In order to create a simple CRUD first we have to think of a simple database table, it's routes using controllers and few views. Ofcourse we need a frontend assets like css,js to showcase our demo. If you are ready then let's begin to enjoy a simple CRUD demo.
Database schema
Let's condider a very simple product database schema.
CREATE TABLE products (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
price DECIMAL(10, 2) NOT NULL,
color TEXT
);
routes and controllers
Now Let's plan some pages to manage operation in this database table product. We will be creating below pages.
- Product List
- In product list we have edit and delete buttons.
- Creare/Update Product (Form)
In order to achive above functionality we have to create a simple ProductController. And This product controller has a mapping of a each actions mentioned above.