Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->searchModel = Yii::createObject(['class' => $this->modelClass]);
     if (!$this->searchModel instanceof UrlModel) {
         throw new InvalidConfigException('$rule->modelClass reference must be an instance of ' . UrlModel::className());
     }
     if (is_null(UrlCategory::findOne($this->category))) {
         throw new InvalidConfigException('Category "' . $this->category . '" does not exists in ' . UrlCategory::tableName() . ' table');
     }
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUrls()
 {
     return $this->hasMany(UrlModel::className(), ['category' => 'id']);
 }