Potrzebuję wyświetlać typy użytkowników zawsze w z góry ustalonej kolejności.
A więc jeśli kolejność użytkowników mam taką: User1, User4, User7, User3 to tak chcę też aby były wyświetlane typy.
Gdy użytkownik niewytypował to na swojej pozycji powinien mieć puste pola.

Obecnie wyświetlane mam typy tylko tych co wytypowali i niestety w różnej kolejności:
Jak to można zrobić ?

TypeRepository:

  1.  
  2. $usersList = array(1,4,7,3);
  3. foreach ($result as $detail) {
  4.  
  5. if(!in_array($detail['meet_id'],$types)) {
  6.  
  7. $types[$detail['meet_id']]['meet_id'] = $detail['meet_id'];
  8. $types[$detail['meet_id']]['host'] = $detail['host'];
  9. $types[$detail['meet_id']]['guest'] = $detail['guest'];
  10.  
  11. $userKey = array_search($detail['username'], $usersList);
  12.  
  13. $types[$detail['meet_id']]['types'][$userKey] = $detail['hostType'].' - '.$detail['guestType'];
  14. }
  15. }


var_dump($types);

  1. array(10) {
  2. [1]=>
  3. array(4) {
  4. ["meet_id"]=>
  5. int(1)
  6. ["host"]=>
  7. string(12) "FC Barcelona"
  8. ["guest"]=>
  9. string(11) "Real Madryt"
  10. ["types"]=>
  11. array(8) {
  12. [0]=>
  13. string(5) "0 - 2"
  14. [1]=>
  15. string(5) "1 - 1"
  16. [2]=>
  17. string(5) "1 - 0"
  18. [3]=>
  19. string(5) "2 - 0"
  20. [4]=>
  21. string(5) "0 - 1"
  22. [5]=>
  23. string(5) "2 - 0"
  24. [6]=>
  25. string(5) "1 - 2"
  26. [9]=>
  27. string(5) "2 - 0"
  28. }
  29. }
  30. [2]=>
  31. array(4) {


tak wyświetlam w TWIG:
  1. {% for key,type in types %}
  2. <tr>
  3. <td>{{ type.host }} - {{ type.guest }}</td>
  4. {% for tp in type.types %}
  5. <td>{{ tp }}</td>
  6. {% endfor %}
  7. </tr>
  8. {% endfor %}
  9. </table>