Admin screens in Zend: controller or module?

2019-02-28 01:29发布

问题:

I am going to create Admin screens in my ZF app. Should I used separate controller or separate module to contain admin section?

My assumption is that this has something to do with application size. If it's small, using a controller for Admin part is ok, isn't it?

回答1:

I don't see the problem with that. Keeping each screen as a separate action, just an AdminController should suffice.

On the other hand, if the admin area is likely to grow to a much larger application, you might as well create a separate module for it now.



回答2:

I think you're right. If it's a small site it wouldn't pe a problem. But for big sites I would recoomend to have seperate admin controllers.



回答3:

I have always used a separate module regardless of application size, to me this just seems to make more sense. Given a typical application (such as a blog which seems to be the common howto) you would want to manage (as an admin) users, posts, comments, etc...

If the admin area is just controller, then posts would be the action, but that doesn't seem to make much sense. The admin section is the actual area (not what you are trying to control). You are attempting to control a post or set of posts (the controller). What you are doing to them (creating, editing, deleting, updating, moderating, etc...) would be the action.