I have three AR models.
Model Window (table Windows) has relation:
return array(
'company' => array(self::BELONGS_TO, 'Company', 'companyId','together'=>true),
'type' => array(self::BELONGS_TO, 'WindowType', 'typeId','together'=>true)
);
Also I have model WindowType with table WindowTypes and model Company with table Companies.
Finding Window model record by PK is easy. But I need to find it by company.url and type.url at once.
I’ve tried the following:
$window = Window::model()
->with(array(
'type'=>array('condition'=>'WindowTypes.url=:url','params'=>array('url'=>$_GET['u'])),
'company'=>array('condition'=>'Companies.url=:curl','params'=>array('curl'=>$_GET['company']))
))
->together()->find();
That’s returned me an error about unexisting column WindowTypes.url. The only way it works is when I replace WindowTypes with t1 and Companies with t2.
So, the question: Is there any correct way to make such query ? Or is it a bug?