/** * create article channe;l */ public function actionCreate() { $params = $this->getParams(); $params['accountId'] = $this->getAccountId(); if (empty($params['name'])) { throw new BadRequestHttpException(Yii::t('microSite', 'channel_name_missing')); } if (!empty($params['fields'])) { foreach ($params['fields'] as $field) { if (empty($field['type']) || empty($field['name'])) { throw new BadRequestHttpException(Yii::t('microSite', 'custom_field_missing')); } } } $articleChannel = new ArticleChannel(); $articleChannel->load($params, ''); if (false === $articleChannel->save()) { throw new ServerErrorHttpException(Yii::t('common', 'save_fail')); } return $articleChannel; }