So my current paginate settings look like this:
public $paginate = array(
'limit' => 30,
'contain' => array(
'Model1' => array(
'fields' => array('id')
),
'Model2' => array(
'conditions' => array(
'Model2.type' => 'Sometype'
),
'Model3' => array(
'fields' => array('someField')
)
)
)
);
What I want to achieve is that when the contained Model2
happens to be empty (there is no Model2
with the type 'Sometype'
), then this record of Model0
(the parent of Model1
and Model2
) should not be included in the returned array of $this->paginate('Model0');
.
How could this be achieved?