Skip to content

Conversation

@SilverFire
Copy link
Member

No description provided.

$query->with('news');
}])
// ->with('tags.news') // the same as above
->orderBy('id desc'),
Copy link

@cebe cebe Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to reduce the overhead of instantiating the News AR instances for tags the following asArray() call can be added:

      'query' => News::find()->with(['tags' => function($q) {
          /** @var ActiveQuery $q */
          $q->with(['news' => function($q) {
              /** @var ActiveQuery $q */
              $q->asArray();
          }]);
      }])->orderBy('id desc'),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants