The return of null values as you describe seems reasonable. I don't
see any mention in the find() method of suppressing the return of null
fields. To avoid the mess in your xml how about iterating through your
data array and unset()ing the elements who's values are null?

Don

On Apr 26, 8:28 am, hugom <ham1...@gmail.com> wrote:
> Hi! I'm having some strange behavior and I want to know if this is the
> expected behavior, it's a bug or something else.
>
> I have a model A related with belongs_to with model B. When I do a
> find('all'), some A models have null the foreign key related with
> table B, and this is the result:
>
> Some model A register:
> array(
>     'model A' => array('field1modelA' => 'value', etc.,
> 'foreignKeyWithModelB' => null),
>     'model B' => 'field1MOdelB'=>null, 'field2ModelB' => null, etc.,
> all nulls)
> );
>
> What I want:
> array('model A' => array('field1modelA' => 'value', etc.,
> 'foreignKeyWithModelB' => null);
>
> I don't want an extra array if the related table register does not
> exists :S I use this with xml helper and i get something ugly like:
>
> <modelA att1=value att2=value foreignKeyWithModelB=null>
> <modelB att1=null att2=null etc/>
> </modelA>
>
> That is ok when foreignKeyWithModelB is not null, but when is null
> there's no related data and I dont want to show something like a model
> with all null. There's a way to avoid this?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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

Reply via email to