Re: Associations to other models

2010-01-13 Thread Kareem Sabri
Excellent, thank you!

On Jan 13, 2:44 am, John Andersen  wrote:
> You have to specify recursive 2 in your find statement. 
> See:http://book.cakephp.org/view/73/Retrieving-Your-Data#find-449
> andhttp://book.cakephp.org/view/439/recursive
> for information on the recursive option.
> Enjoy,
>    John
>
> On Jan 13, 2:35 am, Kareem Sabri  wrote:
>
>
>
> > Hello,
>
> > I have a model called sites. A Site hasAndBelongToMany Entries. An
> > Entry belongsTo one Type and one Saving.
>
> > So, I have an entries_sites table, and an entry has a type_id and a
> > saving_id
>
> > I want to fetch all Entries that belong to a Site, and also get the
> > associated Type and Saving for each Entry. The problem is, if I fetch
> > a Site it will fetch all associated Entries along with it, but won't
> > also fetch the Type and Saving associated with each entry. If I fetch
> > Entries I can't query them based on site_id (as far as I know) because
> > that field isn't in the table, it's in the entries_sites table.
>
> > Is there a way to fetch a Site and get all associated Entries and the
> > associated Type and Saving for each Entry? Thanks in advance!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Associations to other models

2010-01-12 Thread John Andersen
You have to specify recursive 2 in your find statement. See:
http://book.cakephp.org/view/73/Retrieving-Your-Data#find-449
and
http://book.cakephp.org/view/439/recursive
for information on the recursive option.
Enjoy,
   John

On Jan 13, 2:35 am, Kareem Sabri  wrote:
> Hello,
>
> I have a model called sites. A Site hasAndBelongToMany Entries. An
> Entry belongsTo one Type and one Saving.
>
> So, I have an entries_sites table, and an entry has a type_id and a
> saving_id
>
> I want to fetch all Entries that belong to a Site, and also get the
> associated Type and Saving for each Entry. The problem is, if I fetch
> a Site it will fetch all associated Entries along with it, but won't
> also fetch the Type and Saving associated with each entry. If I fetch
> Entries I can't query them based on site_id (as far as I know) because
> that field isn't in the table, it's in the entries_sites table.
>
> Is there a way to fetch a Site and get all associated Entries and the
> associated Type and Saving for each Entry? Thanks in advance!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Associations to other models

2010-01-12 Thread Kareem Sabri
Hello,

I have a model called sites. A Site hasAndBelongToMany Entries. An
Entry belongsTo one Type and one Saving.

So, I have an entries_sites table, and an entry has a type_id and a
saving_id

I want to fetch all Entries that belong to a Site, and also get the
associated Type and Saving for each Entry. The problem is, if I fetch
a Site it will fetch all associated Entries along with it, but won't
also fetch the Type and Saving associated with each entry. If I fetch
Entries I can't query them based on site_id (as far as I know) because
that field isn't in the table, it's in the entries_sites table.

Is there a way to fetch a Site and get all associated Entries and the
associated Type and Saving for each Entry? Thanks in advance!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en