On Mon, Oct 5, 2009 at 8:45 PM, MeanStudios <[email protected]> wrote: > > Greetings, > > I'm not sure if this is a bug or not but here it goes. If I have 3 > models (Layout, Template, Page). Layout has many Page and Template. > Page and Template have only one Layout. If I am in the > PagesController and I do something like $this->Page->Layout->findById > ($id) it should return an array with with Layout data as well as all > the templates and pages that are related to the passed layout id, > correct? Well it's not. The only way I can get that data is if I do > a bind right before the findById() like so > $this->Page->Layout->bindModel(array('hasMany' => array('Template' => > array('className' => 'Template')))); > $this->Page->Layout->findById($id); > > That will return an array of the Layout Data as well as an array of > all the templates that Layout has associated to it. > > Yes, my $hasMany and $belongsTo definitions are setup correctly > because I can go into the LayoutsController and just do: > $this->Layout->findById($id); > and it will return all the data it's supposed to. > > Yes I am using prefixes for my plugin controllers, models, views, > etc. It's just less confusing if I don't do it here. > > I'm pretty sure that I don't need the bind when not working inside a > template but inside a regular controller.
If the associations are correct, that would seem odd. Can you try it using Containable? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
