Post
Post_category
-post_id
-catgory_id
Category
Пытаюсь получить все посты определенной категории
выдает null$post = $driver->category;
Помогите что не так?
Код: Выделить всё
public function getCategory()
{
return $this->hasMany(Category::className(), ['id' => 'category_id'])
->via('postCategory');
}
public function getPostCategory()
{
return $this->hasMany(PostCategory::className(), ['post_id' => 'id'])
->via('post');
}
public function getPost()
{
return $this->hasMany(Post::className(), ['post_id' => 'id']);
}