Quantcast

getting cousin data

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

getting cousin data

Michael Bryant
I am new to CakePHP. I am trying to understand the models.

I have Accounts that BelongsTo Contacts and Phones.

the Contacts also  BelongsTo Phones

Phones BelongsTo PhoneType

PhoneType hasMany Phones

What I want to do is View an Account and get the list of Phones and the name of the Phone type

I get the list of Phones, but not the associated PhoneType info.


Thanks for your help.

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: getting cousin data

Greg Skerman
use the containable behavior

On Sat, Sep 22, 2012 at 6:13 AM, Michael Bryant <[hidden email]> wrote:
I am new to CakePHP. I am trying to understand the models.

I have Accounts that BelongsTo Contacts and Phones.

the Contacts also  BelongsTo Phones

Phones BelongsTo PhoneType

PhoneType hasMany Phones

What I want to do is View an Account and get the list of Phones and the name of the Phone type

I get the list of Phones, but not the associated PhoneType info.


Thanks for your help.

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: getting cousin data

Anja Liebermann-2
In reply to this post by Michael Bryant
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Michael,


so one Phone can have many accounts? ok?
On which level have you set recursive?
0 will get you just the account
1 should get you Account and Phone
2 should get you Account, Phone and PhoneType

If you see that you get huge arrays with data you won't need you should
consider zu work with Containable which is automatically active with
Cake 2.0. That will help you to get the data you really want. With
containable you can deifine the rules for the data you really need. Very
powerful, very handy.


HTH!

Anja




Am 21.09.2012 22:13, schrieb Michael Bryant:

> I am new to CakePHP. I am trying to understand the models.
>
> I have Accounts that BelongsTo Contacts and Phones.
>
> the Contacts also  BelongsTo Phones
>
> Phones BelongsTo PhoneType
>
> PhoneType hasMany Phones
>
> What I want to do is View an Account and get the list of Phones and the *name
> of the Phone type*
> *
> *
> I get the list of Phones, but not the associated PhoneType info.
>
>
> Thanks for your help.
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlBdw4AACgkQbOdiIJzHNKGMTQCgwosvnOI++rbb/416KeWnELs3
NcYAnR9DnN+fuaaT2ueR5M5lXK4ymRnc
=WjTV
-----END PGP SIGNATURE-----

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Loading...