Yes, using an AdminController can prevent duplicate code. My backend controllers would almost always have at least "index", "add", "edit" and "delete" methods. Those methods, created on AdminController, let me have on my backend controllers only any extra methods I would need. Creating add/edit/delete/index methods over and over seems to me a waste of time.
Currently, using my 1.x modification, when I'm creating a backend module, I just create the table, create an almost empty backend controller, and that's it. Of course there are cases which I need some extra methods (such as "activate" or "show"), but the default actions are already working. I also created "beforeDelete", "afterSave" and some other methods to be able to set anything before the AdminController saves/deletes something, or after saving/deleting. Anyway, after some years using that way, I really prefer to change Cake's core again, or keep using 1.x, than stop using that way. On Fri, Feb 3, 2012 at 5:03 AM, Stephen <[email protected]> wrote: > I always assumed it was much better to use a prefix than to separate your > controllers or possibly duplicate code? > > Using the AdminController extension (which I assume extends AppController?), > can this prevent duplicate code and what are the benefits if you don't mind > me asking? > > Kind Regards > Stephen > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
