Код: Выделить всё
$query = News::find()
->where('{{%news}}.active=:a',[':a'=>1])
->andWhere('{{%news}}.publishto<=:b',[':b'=>new Expression('NOW()')])
->orderBy(['{{%news}}.publishto'=>SORT_DESC]);
Код: Выделить всё
$query = News::find()
->where('{{%news}}.active=:a',[':a'=>1])
->andWhere(new Expression('{{%news}}.publishto<=NOW()'))
->orderBy(['{{%news}}.publishto'=>SORT_DESC]);
Код: Выделить всё
SELECT * FROM `vg_news` WHERE (`vg_news`.active=1) AND (`vg_news`.publishto<=NOW()) ORDER BY `vg_news`.publishto DESC