I want to have a crud controller page. With urls like ?id=1&action=edit to get form to edit first record, the same link to delete with delete action, a url with ?action=add to get blank form to add a new record. All these three after submition must go to the same page with no query part in url to get listing/pagination with a success message in top of the listing if first access to the page then no success message in top until they click add/edit/delete icons to go the query url to get the form…
These all with symphony Form/Templating:
- do I need to setup four routers in the page to call crud method?
- do i need separate template files to get listing and form?
- do I need separate crud class for each page to take actions with different tables?
- If I have two pages product.php and user.php to manage listing/delete/add/edit, does it make sense to have one user.php file just for listing/edit… containing routers to action methods and another user.php containing action methods? isn’t it better to have just one user.php for both? if yes, how to do this? in top of file defining four routers and lower the same file having crud class with action methods? I think the purpose of action controller class with routers is when everything is done via a main script rather than having separate pages like user.php, product.php etc.? and that way is good only when we have one index.php that handles both product and user? right? please advice the best practice.
Please advice what is the best way to do this with symfony?