public function actionCreate() { if (!self::can('domainTopology/create')) { if (!self::can("domainTopology/read")) { return $this->goHome(); } else { Yii::$app->getSession()->addFlash('warning', Yii::t('topology', 'You are not allowed to add networks')); return $this->redirect(array('index')); } } $network = new Network(); if ($network->load($_POST)) { if ($network->save()) { Yii::$app->getSession()->addFlash("success", Yii::t('topology', 'Network {name} added successfully', ['name' => $network->name])); return $this->redirect(array('index')); } else { foreach ($network->getErrors() as $attribute => $error) { Yii::$app->getSession()->addFlash("error", $error[0]); } $network->clearErrors(); } } return $this->render('create', ['domains' => self::whichDomainsCan('domainTopology/create'), 'network' => $network]); }