Controllers in highly transactional application.

There are saveral tables in the application and each require insert/update/delete functions. Which method best suits for such type of application.

Generate CRUD for each table and customise its operation. Is it advisible to have saperate controller for each model & Views (Generated via CRUD) or There is michenism to handle all this via single controller?

Everything’s depends on the whole design of your applications.

The usual and simple approach, which is supported by Gii is to have model for a table and, if you need CRUD operations for this table, then to create controller with relevant view files.

So, for example, having table user, you may have, for a start, automatically generated:




In addition you can use inheritance, of course, for your classes. Like , ParentModel.php with ChildModel1.php and ChildModel2.php, for example

Common practice is to use one controller for model + related models.

For example, if Post has many Comments, you may probably want to display last comments on Post view. These models are related, so that’s ok.

But you should think twice if you want to use unrelated model (for example, Car) in PostController.

Btw it’s not clear for me what you mean by “highly transactional application”, can you elaborate?