Re: CakePHP Containable on Associated Model
Hi Michael,
I tried to get it working, but I still only get the same results as
above. What I want is a list of every book, and then in that same
query I want only logs of the specified user, instead I am getting
only books with logs of the specified user...not all books. Any
ideas?
On May 5, 9:53 am, Michael Stelly <mjste...@gmail.com> wrote:
> Yes, I'd work it using
> Containable<http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html>
> .
>
> Sincerely,
> Michael Stelly
>
>
>
>
>
>
>
> On Thu, May 3, 2012 at 9:59 PM, Rob <bizarro...@gmail.com> wrote:
> > I have a setup where there are Books Users and Logs. Each Log has a
> > Book and a User and I am trying to retrieve a list of all the books
> > regardless of the user, but then also retrieve the Logs associated
> > with that book (recursive is set to 1), but then only retrieving the
> > logs of the current logged in user.
>
> > Hopefully that's clear. I tried using Containable and like so:
>
> > $this->Book->contain('Log.user_id = 2');
>
> > But unfortunately this leaves out Books for which User 2 has no logs
> > for. Am I going about this correctly and I'm just not using
> > containable properly, or am I doing this all wrong.
>
> > Let me know if anything needs to be clarified or expanded...Any help
> > is appreciated!
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home