I have a Model1 that hasOne Model2, but not each Model1 hasOne Model2
And I am trying to get all Model1 that has Model2.field == 1 OR does not have Model2
in beforeFind
public function beforeFind($event)
{
$this->getDbCriteria()->mergeWith(array(
'with' => array('Model2' => array(
'on'=>'Model2.field=1'
),)
));
return parent::beforeFind($event);
}
the query is loading extremely long time without the proper result, and not diisplaing the correct Model2.field value