255], [['post_id'], 'exist', 'skipOnError' => true, 'targetClass' => News::class, 'targetAttribute' => ['post_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'name' => 'Name', 'description' => 'Description', 'created_at' => 'Created At', 'post_id' => 'Post ID', ]; } /** * Gets query for [[GalleryItems]]. * * @return \yii\db\ActiveQuery */ public function getGalleryItems() { return $this->hasMany(GalleryItem::class, ['gallery_id' => 'id']); } /** * Gets query for [[Post]]. * * @return \yii\db\ActiveQuery */ public function getPost() { return $this->hasOne(News::class, ['id' => 'post_id']); } }