I have model 1 represent a table with (id1,par1, para2 ) and model 2 represent a table with (id2,para3)
I want to modify model 1 in order when I use
$mydata = model1::model()->findBySql('SELECT * FROM table1 ORDER BY id1 DESC');
this query return for me directly only where par1 > par3 (both of them are time), without adding the condition where . Or if thee is a method to add a condition where based in other model ?
class model1 extends CActiveRecord
{
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function tableName()
{
return 'table1';
}
}
Many thanks.
thanks for all comments, I solve it by using two cdbcreteria and make a condition between them
see my post here