Tuesday, November 24, 2009

Containable query

Hey all,

I have this relationship in question:

User -> hasOne Student -> hasMany Submission

I'm a bit stumped on how I can fetch all the users who do not have any submissions linked to their name.

I've tried:

        $list = $this->User->find('all', array(
          'contain' => array(
            'Student' => array(
              'Submission' => array(
                'conditions' => array(
                  'Submission.student_id' => null
                )
              ),
            )
          )
        ));

I have the actAs in the model so the containable behaviour is functioning - there is just a problem with my specific query.

Any ideas?

thanks!

--

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

No comments: