Exemplo n.º 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategory()
 {
     return $this->hasOne(ArticleCategory::className(), ['id' => 'category_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParent()
 {
     return $this->hasMany(ArticleCategory::className(), ['id' => 'parent_id']);
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['label', 'alias', 'content', 'date'], 'required'], [['category_id', 'views', 'published', 'position'], 'integer'], [['announce', 'content'], 'string'], [['date'], 'date', 'format' => 'yyyy-MM-dd'], [['label', 'alias', 'tags'], 'string', 'max' => 255], [['category_id'], 'exist', 'targetClass' => \common\models\ArticleCategory::className(), 'targetAttribute' => 'id'], [['views'], 'default', 'value' => 0], [['published'], 'default', 'value' => 1], [['position'], 'default', 'value' => 0], [['alias'], 'unique']];
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getArticleCategories()
 {
     return $this->hasMany(ArticleCategory::className(), ['article_id' => 'id']);
 }
Exemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getModel()
 {
     return $this->hasOne(ArticleCategory::className(), ['id' => 'model_id']);
 }