$project = Project::find()->with(['group', 'userShare', 'author'])->where(['id' => $id])->one();
return ArrayHelper::toArray($project, ['app\models\Project' => array_merge($project->fields(), ['group',
'userShare' => function ($project) {
$share = $project->userShare;
$share = array_map(function($elem) {
$elem->profile = $elem->profileq;
return $elem;
}, $share);
return $share;
},
'author'])]);