Yii2 : Active Record add Not In condition

Well all query operands seems now merged within in yii\db\QueryInterface::Where() per documentation an In condition can now be added using something like $query = MyModel::find()->where([‘attribute’=>$array]); for a not In condition it is slightly different format $query = MyModel::find()->where([‘not in’,’attribute’,$array]);

Execute my code before any action of any controller

In case you need to execute a code before every controller and action, you can do like below: 1 – Add a component into your components directory, for example(MyGlobalClass): namespace app\components; class MyGlobalClass extends \yii\base\Component{ public function init() { echo “Hi”; parent::init(); } } 2 – Add MyGlobalClass component into your components array in config … Read more