I need to do the following query using the CakePHP find method:
SELECT * FROM `ads`
INNER JOIN fields_values ON fields_values.ref_id = ad.id
WHERE ad.active = 1
I tried this function, but she doesn't work :
$ads = $this->Ad->find('all', array(
'joins' => array(
array(
'table' => 'fields_values',
'alias' => 'fv',
'type' => 'INNER',
'conditions' => array(
"Ad.id = fv.ref_id "
)
)
),
'conditions' => array(
'Ad.active' => 1
),
));