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:
foreach ($result as $detail) { $types[$detail['meet_id']]['meet_id'] = $detail['meet_id']; $types[$detail['meet_id']]['host'] = $detail['host']; $types[$detail['meet_id']]['guest'] = $detail['guest']; $types[$detail['meet_id']]['types'][$userKey] = $detail['hostType'].' - '.$detail['guestType']; } }
var_dump($types);
[1]=> ["meet_id"]=> int(1) ["host"]=> string(12) "FC Barcelona" ["guest"]=> string(11) "Real Madryt" ["types"]=> [0]=> string(5) "0 - 2" [1]=> string(5) "1 - 1" [2]=> string(5) "1 - 0" [3]=> string(5) "2 - 0" [4]=> string(5) "0 - 1" [5]=> string(5) "2 - 0" [6]=> string(5) "1 - 2" [9]=> string(5) "2 - 0" } } [2]=>
tak wyświetlam w TWIG: