public function getBlocks() { if (!empty($this->blocks)) { $query = Block::find()->where(['block_id' => $this->blocks])->orderBy([new \yii\db\Expression('FIELD (block_id, ' . implode(', ', $this->blocks) . ')')]); return $query->all(); } return []; }
public function actionIndex() { return $this->render("index", ["blocks" => Block::find()->where(["used" => BooleanEnum::FLASE])->all(), "areas" => Area::find()->all()]); }