/**
  * @param Request $Request
  * @return TrackRelayTeam
  */
 private function createRelayTeamFromRequest(Request $Request)
 {
     $RelayTeam = new TrackRelayTeam();
     $RelayTeam->setRelayTeamName($Request->get('relayTeamName'))->setHasSetSchoolRecord($Request->get('setSchoolRecord'))->setHasMedaled($Request->get('medaled'));
     if ($Request->get('trackRelayTeamId')) {
         $RelayTeam->setTrackRelayTeamId($Request->get('trackRelayTeamId'));
     }
     $Result = $this->createResultTimeFromRequest($Request);
     if ($Result) {
         $RelayTeam->setResult($Result);
     }
     if ($Request->get('overallPlace')) {
         $RelayTeam->setOverallPlace($Request->get('overallPlace'));
     }
     if ($Request->get('place')) {
         $RelayTeam->setPlace($Request->get('place'));
     }
     if ($Request->get('heatNumber')) {
         $RelayTeam->setHeatNumber((int) $Request->get('heatNumber'));
     }
     return $RelayTeam;
 }
Ejemplo n.º 2
0
 /**
  * @param TrackEvent $TrackEvent
  * @param TrackRelayTeam $RelayTeam
  * @param $TeamMembers TrackRelayTeamMember[]
  * @return int
  */
 public function addRelayTeamEvent(TrackEvent $TrackEvent, TrackRelayTeam $RelayTeam, $TeamMembers)
 {
     if (!$TrackEvent->getTrackEventId()) {
         $RelayTeam->setTrackEventId($this->getMeetEventId($TrackEvent));
     }
     if (!$RelayTeam->getTrackEventId()) {
         return 0;
     }
     $trackRelayTeamId = $this->TrackSQL->addRelayTeam($RelayTeam);
     if (!$trackRelayTeamId) {
         return 0;
     }
     foreach ($TeamMembers as $TeamMember) {
         $TeamMember->setTrackRelayTeamId($trackRelayTeamId);
         $this->TrackSQL->addRelayTeamMember($TeamMember);
     }
     return 1;
 }