I saw this thread before posting. In thread which you posted there no
any solution than foreach/if.
You can see that I wrote that 'how can
I exclude this empty array (whole [2] array I mean) without using
foreach/if blocks? I know that using bindModel will do all as well
but
this is not for my question ;) So, how?'

On 9 дек, 17:07, "j.blotus" <[email protected]> wrote:
> Please see
>
> http://groups.google.com/group/cake-php/browse_thread/thread/f649c3b2...
>
> On Dec 9, 9:44 am, Andrew Hodirevski <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hello!
> > I have the next question.
>
> > There is part of code:
>
> >             $result = $this->find('all', array(
> >                 'contain' => array(
> >                     'User' => array(
> >                         'fields' => 'id',
> >                         'conditions' => array(
> >                             'id' => $user_id
> >                         )
> >                     )
> >                 ),
> >                 'fields' => 'url'
> >             ));
>
> > This find() called in method of Project model class and I want to
> > retrieve just projects where User.id equal some user id passed to my
> > method.
> > User HABTM Project and Project HABTM User.
>
> > But after executing I have the next:
>
> > app/views/projects/index.ctp (line 1)
>
> > Array
> > (
> >     [0] => Array
> >         (
> >             [Project] => Array
> >                 (
> >                     [url] =>http://purpled.biz
> >                     [id] => 1
> >                 )
>
> >             [User] => Array
> >                 (
> >                     [0] => Array
> >                         (
> >                             [id] => 4
> >                             [ProjectsUser] => Array
> >                                 (
> >                                     [user_id] => 4
> >                                     [project_id] => 1
> >                                     [projects_users_role_id] => 0
> >                                 )
>
> >                         )
>
> >                 )
>
> >         )
>
> >     [1] => Array
> >         (
> >             [Project] => Array
> >                 (
> >                     [url] =>http://google.com
> >                     [id] => 2
> >                 )
>
> >             [User] => Array
> >                 (
> >                     [0] => Array
> >                         (
> >                             [id] => 4
> >                             [ProjectsUser] => Array
> >                                 (
> >                                     [user_id] => 4
> >                                     [project_id] => 2
> >                                     [projects_users_role_id] => 0
> >                                 )
>
> >                         )
>
> >                 )
>
> >         )
>
> >     [2] => Array
> >         (
> >             [Project] => Array
> >                 (
> >                     [url] =>http://test.com
> >                     [id] => 3
> >                 )
>
> >             [User] => Array
> >                 (
> >                 )
>
> >         )
>
> > )
>
> > As you see there is the last array with empty [User] array, so how can
> > I exclude this empty array (whole [2] array I mean) without using
> > foreach/if blocks? I know that using bindModel will do all as well but
> > this is not for my question ;) So, how?

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to