Exemplo n.º 1
0
 public function getAllMatchPlayers($match_id)
 {
     try {
         $match_players = Match::getAllMatchPlayers($match_id);
         if (count($match_players) == 0) {
             throw new \Exception("No match players for match " . $match_id);
         }
         //-- Get Match Player Info
         $list_of_ids = [];
         $return = [];
         foreach ($match_players as $mp) {
             $user_id = $mp['user_id'];
             $list_of_ids[] = $user_id;
             $return[$user_id] = $mp;
         }
         $user_info = User::getByListOfIds($list_of_ids);
         foreach ($user_info as $user_object) {
             $user_data = $user_object->toArray();
             $user_id = $user_data['user_id'];
             $return[$user_id] = array_merge($return[$user_id], $user_data);
         }
         return $return;
     } catch (\Exception $e) {
         throw $e;
     }
 }