Пример #1
0
 /**
  * @param match $match
  * @param bool $lazy if true - update all data, if false - only possible updated data
  */
 public function update($match, $lazy = true)
 {
     $db = db::obtain();
     $slots = $match->get_all_slots();
     // update common match info
     $db->update_pdo(db::real_tablename('matches'), $match->get_data_array(), array('match_id' => $match->get('match_id')));
     foreach ($slots as $slot) {
         // update accounts
         $db->update_pdo(db::real_tablename('users'), array('account_id' => $slot->get('account_id'), 'steamid' => player::convert_id($slot->get('account_id'))), array('account_id' => $slot->get('account_id')));
         // update slots
         if (!$lazy) {
             $db->update_pdo(db::real_tablename('slots'), $slot->get_data_array(), array('match_id' => $slot->get('match_id'), 'player_slot' => $slot->get('player_slot')));
         }
     }
 }