public function actionBind($id) { $cat = Category2gis::findOne($id); if (!$cat) { throw new \yii\web\NotFoundHttpException("Неверный id родительской категории :("); } $childs = $cat->getChilds(); $binds = []; foreach ($childs as $child) { if ($child->cats2dis) { $ids = explode(',', $child->cats2dis); $binds[$child->id] = Category2dis::findAll(['catid' => $ids]); } } return $this->render('bind', ['cat' => $cat, 'childs' => $childs, 'ddis_roots' => Category2dis::getRoots(), 'binds' => $binds]); }