-
Controllers VS Actions
Hi Guys,
I'm fairly new to the Zend Framework but not to MVC design patterns.
I'm working on an app for a client and I want to implement it using the Zend Framework. The App will have a front-end and several back-end panels for different type of users. My problem is, I'm not sure if I need to break to application into separate modules or just separate controllers for each panel? For example:
Separate Modules
HomeModule
- IndexController
- ContactController
- AboutController
AdminModule
- PostsController
? addAction
? editAction
? deleteAction
? viewAction
- StatisticsController
or Separate Controllers
IndexController
- indexAction
- contactAction
- aboutAction
AdminController
- addPostAction
- editPostAction
- deletePostAction
- statisticsAction
The first approach will result in more Controller while the latter will result in more Actions. It will be easier for me to use the second approach ( a controller for each panel ) as I haven't had any experience with zf apps that contain multiple modules, but I'm not entirely sure that this is the right approach...
I hope it's not too confusing?! I wasn't sure what's the best way to illustrate my problem.
Thanks!
-
Hello,
It will be hard to add more actions to the AdminController, I think the second one not an easily maintainable approach. I use another way: one module, one AdminController and some frontend controller for each module.
StatisticsModule
- AdminController
- IndexController
PostModule
- AdminController
- IndexController
It causes one problem: the "admin" word must be after the module name. It can be solved by the following routing: https://github.com/szjani/equlib/blo...AdminRoute.php
In this case the addPost action in the AdminController will also be available when the URL is "admin/post/add-post"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules