Пример #1
0
 /**
  * Fetch Matchs which references this ManchesEquipes. Will return null in case reference is invalid.
  * `manches_equipes`.`id_match` -> `matchs`.`id_match`
  *
  * @param PDO $db a PDO Database instance
  * @param array $sort array of DSC instances
  * @return Matchs
  */
 public function fetchMatchs(PDO $db, $sort = null)
 {
     $filter = array(Matchs::FIELD_ID_MATCH => $this->getIdMatch());
     $result = Matchs::findByFilter($db, $filter, true, $sort);
     return empty($result) ? null : $result[0];
 }
Пример #2
0
 /**
  * get single Matchs instance from a DOMElement
  *
  * @param DOMElement $node
  * @return Matchs
  */
 public static function fromDOMElement(DOMElement $node)
 {
     $o = new Matchs();
     $o->assignByHash(self::domNodeToHash($node, self::$FIELD_NAMES, self::$DEFAULT_VALUES, self::$FIELD_TYPES));
     $o->notifyPristine();
     return $o;
 }
Пример #3
0
 public function executeDuplicate(sfWebRequest $request)
 {
     $match = $this->getRoute()->getObject();
     $this->forward404Unless($match);
     $newMatch = new Matchs();
     $newMatch->setIp($match->getIp());
     $newMatch->setServer($match->getServer());
     $newMatch->setSeason($match->getSeason());
     $newMatch->setTeamA($match->getTeamA());
     $newMatch->setTeamAFlag($match->getTeamAFlag());
     $newMatch->setTeamAName($match->getTeamAName());
     $newMatch->setTeamB($match->getTeamB());
     $newMatch->setTeamBFlag($match->getTeamBFlag());
     $newMatch->setTeamBName($match->getTeamBName());
     $newMatch->setScoreA(0);
     $newMatch->setScoreB(0);
     $newMatch->setMaxRound($match->getMaxRound());
     $newMatch->setRules($match->getRules());
     $newMatch->overtime_startmoney = $match->overtime_startmoney;
     $newMatch->overtime_max_round = $match->overtime_max_round;
     $newMatch->config_full_score = $match->config_full_score;
     $newMatch->config_ot = $match->config_ot;
     $newMatch->config_streamer = $match->config_streamer;
     $newMatch->config_knife_round = $match->config_knife_round;
     $newMatch->config_password = $match->config_password;
     $newMatch->map_selection_mode = $match->map_selection_mode;
     $newMatch->setConfigAuthkey(uniqid(mt_rand(), true));
     $newMatch->setStatus(Matchs::STATUS_NOT_STARTED);
     $newMatch->save();
     $maps = new Maps();
     $maps->setMatch($newMatch);
     $maps->setMapsFor("default");
     $maps->setNbOt(0);
     $maps->setStatus(0);
     $maps->score_1 = 0;
     $maps->score_2 = 0;
     $maps->current_side = $match->getMap()->getCurrentSide();
     $maps->setMapName("tba");
     $maps->save();
     $newMatch->setCurrentMap($maps);
     $newMatch->save();
     $this->getUser()->setFlash("notification_ok", $this->__("Match cloned with ID") . " " . $newMatch->getId());
     $this->redirect("matchs_current");
 }
Пример #4
0
 /**
  * Fetch Matchs's which this Tournoi references.
  * `tournoi`.`id_tournoi` -> `matchs`.`id_tournoi`
  *
  * @param PDO $db a PDO Database instance
  * @param array $sort array of DSC instances
  * @return Matchs[]
  */
 public function fetchMatchsCollection(PDO $db, $sort = null)
 {
     $filter = array(Matchs::FIELD_ID_TOURNOI => $this->getIdTournoi());
     return Matchs::findByFilter($db, $filter, true, $sort);
 }