I'm trying to open a gridview. The data I pull up for each column separately lambda. The problem is this: for several columns, I get the same related data, for example:
echo GridView::widget([ 'dataProvider' => new ActiveDataProvider([ 'query' => Article::find() ]), 'columns' => [ [ 'attribute' => 'user name', 'value' => function ($model) { return $model->getUser()->name; }, ], [ 'attribute' => 'user email', 'value' => function ($model) { return $model->getUser()->email; }, ], ], ]); Those. It turns out two user requests, although one would be enough. Considering the fact that this is just an example, in fact there are even more requests - this greatly hurts speed. How can this problem be solved?