I\'ve got a model (Listings) that has and belongs to a few different models, I\'d like to find all of this model where it\'s related model (Openhouses) have a condition. The
If you have a lot of linked models, settings recursive to 2 might bring more data than you might want.
If that is true, there is an alternative to what mavarro said, you can also try using the Containable behaviour:
$this->Listing->find
(
'all',
array
(
'conditions' => array
(
'Openhouse.date >' => $openhouse_start->format('Y-m-d H:i:s'),
'Openhouse.date <' => $openhouse_end->format('Y-m-d H:i:s')
),
'contain' => array('Openhouse')
)
);