Why would profile be related to a post? The relationship is the user.

On May 12, 9:09 am, dreamingmind <dreamingmin...@gmail.com> wrote:
> With the setup you have, wouldn't the profile come along for the ride
> on your finds? I would expect to be able to get a returned array like
> this:
>
> array(
> [0]
>   Post => post fields
>   User => user fields
>                 Profile => profile fields
> [1]
>   Post => post fields
>   User => user fields
>                 Profile => profile fields
>
> Regards,
> Don
>
> On May 12, 8:57 am, amiable_indian <mithu.si...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I am having tough time trying to join two table which are not connected
> > directly. For example:
>
> > User hasOne Profile
> > User hasMany Post
>
> > I want to join Post and Profile (based on user_id which is common) and tried
> > doing couple of things but none worked.
>
> > * Firstly, I tried $hasOne in Post model with ( 'foriegnKey' => false,
> > 'condition' => 'Post.user_id = Profile.user_id' ). That didn't worked.
> > * Secondly, I tried using putting 'joins' in $conditions for
> > $this->Post->find(...). That didn't worked either.
>
> > Last option would be use raw_query, but I am trying to avoid using that.
>
> > Any suggestions?

-- 
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

Reply via email to