I struggle with the problem for a long time, but I still don’t understand how to solve it. There are 3 tables:
- list of users of employees
- a list of employee_positions posts (the external key id_user to the id of the employees table and the external key id_department to the id of the departments table) - each user has several posts from different departments
- list of units
I do a query to the database like this:
$dataProvider = new SqlDataProvider([ 'sql' => ' SELECT * FROM `employees` e LEFT JOIN `employee_positions` p ON e.id=p.id_user LEFT JOIN `departments` d ON d.id=p.id_department ORDER BY e.fio ASC ', 'totalCount' => $count, ]); In the view I display the results, it turns out that each user is duplicated - how many posts he has so many lines. And I need each user to be once, but in the right column all his posts are listed and to which division this post belongs. Is it possible using GridView::widget ?
I tried to display a samopisnuyu table, but did not understand how to get the results from the provider $dataProvider ? var_dump($dataProvider) - does not contain the data itself.