/** * @return \yii\db\ActiveQuery */ public function getBlogs() { return $this->hasMany(Blog::className(), ['department_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getBlog() { return $this->hasOne(Blog::className(), ['id' => 'blog_id']); }
/** * @return \yii\db\ActiveQuery */ public function getBlogs() { return $this->hasMany(Blog::className(), ['id_user' => 'id']); }
/** * @inheritdoc */ public function rules() { return [[['comment'], 'required'], [['user_id', 'blog_id'], 'integer'], ['user_id', 'exist', 'targetClass' => User::className(), 'targetAttribute' => 'id'], ['blog_id', 'exist', 'targetClass' => Blog::className(), 'targetAttribute' => 'id'], [['create_date'], 'safe'], [['comment'], 'string', 'max' => self::MAX_LENGTH_COMMENT]]; }