On Fri, Jul 20, 2012 at 5:44 PM, geste <jim.ho...@gmail.com> wrote: > However, I find myself writing a lot of snippets in controllers that > essentially go "WHERE active = '1'" and that seems like it could be a pain > and error-prone over time. > > What I'd like to do is leave "People" alone but create a new model or model > called "Users" that simply flters People for active=1. And maybe a > corresponding model that is OldUsers and feteches active=0. > > I started to implement something like this at the controller level but then > asked myself why not implement at Model level. Does this seems liek a > rational approach. Can anyone point to some good examples outside of basic > API docs?
The model is the perfect place to put this. Have a look at creating custom find types (http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#creating-custom-find-types) You can set whatever filters you want in there. Mike. -- 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php