Как организовать связь многие ко многим в Yii2?
Вот как это делается:class FilmCategory {.....
public function getFilms(){
        return $this->hasMany(Films::className(), ['film_id' => 'film_id'])
            ->viaTable('films_categories', ['category_id' => 'category_id']);
    }
Так пробовали?// join with multiple relations
// find the orders that contain books and were placed by customers who registered within the past 24 hours
$orders = Order::find()->innerJoinWith([
    'books',
    'customer' => function ($query) {
        $query->where('customer.created_at > ' . (time() - 24 * 3600));
    }
])->all();
// join with sub-relations: join with books and books' authors
$orders = Order::find()->joinWith('books.author')->all();