Model Category on my app: var $hasMany = array('Article', 'ChildCategory' => array( 'className' => 'Category', 'dependent' => false, 'foreignKey' => 'parent_id', 'order' => 'ChildCategory.order ASC', ) );
So you can see that I can relate a model with itself. Cheers, mbavio On May 8, 5:08 pm, jmmg77 <[EMAIL PROTECTED]> wrote: > Thank you for your help. Is this example model something other than > book? > > What I am trying to do is not typical associations between models. > > It would be like this, I have a table called books. I would like to > create two different models that behave as if there are two completely > different tables, but they are both based on the 'books' table. > > The first model would be called 'novel' where booktype = 1. > The second would be called 'studyguide' where booktype = 2. > > Again, in this example, there are many reasons not to do this, but I > do have a specific need for something like this. > > On May 8, 2:44 pm, mbavio <[EMAIL PROTECTED]> wrote: > > > When you define the model associations, you can add a "conditions" key > > to the array. Check the CookBook and you will understand what I mean. > > Wait, let me give you an example: > > > var $hasMany = array('Book' => array('conditions' => > > array('Book.price' => '!= 0'))); > > > Hope this can help you. > > > Cheers, > > mbavio > > > On May 8, 3:11 pm, jmmg77 <[EMAIL PROTECTED]> wrote: > > > > My question is simple, but I haven't been able to find the answer. > > > I'm using Cakephp1.2 which I'm really liking, but I can't seem to > > > figure this one out. > > > > Is there a way to hard code conditions in the model itself. I'm not > > > talking about associations just the model itself. > > > > An example would be if I have a 'people' table. Can I create a model > > > called 'members' that filters all people with a valid memberid? > > > > (there would be no good reason to do this, this is simply an example). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---