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.
感谢您的所有评论,我通过使用两个cdbcreteria解决了这个问题,并在它们之间建立了条件, 请参见此处
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.