Tuesday, July 31, 2012

Re: control visibility of field with second level of depth

Have you tried using the 'Containable' behavior? http://book.cakephp.org/1.3/view/1323/Containable 

2012/7/30 Mariano C. <mariano.calandra@gmail.com>:
> I have this json:
>
> {
>
> Offices:
> [
>
> {
>
> Office:
> {
>
> address: "JR street"
> Company:
> {
>
> id: "3",
> name: "ABC Software"
>
> },
>
> },
> Person:
> {
>
> id: "1",
> first_name: "M",
> last_name: "c",
>
> }
>
> }
>
> }
>
> I want to show only few fields of the entire set, for example I would show
> just Office.Company.name but if I write this into model:
>        
>>
>> $options['fields'] = array("Person.id", "Person.first_name",
>> "Person.last_name", "Office.region", "Company.name");
>
>  or
>
>> $options['fields'] = array("Person.id", "Person.first_name",
>> "Person.last_name", "Office.region", "Office.Company.name");
>
>
> This will get me an error cause Company.name or Office.Company.name is
> unknown.
>
> --
> 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



--
-Carlos

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

No comments: