Ejemplo n.º 1
0
 /**
  * 
  * @param stdClass $input
  * @param stdClass $parentInput
  * @param GameAction $oGameAction
  * @return GameAction
  */
 public static function mapGameActionFromAPI($input, $parentInput, GameAction $oOutput = null)
 {
     $oGameActionType = NefubTypeMapper::mapTypeFromAPI($input->Type, 'GameActionType');
     $time = date('H:i:s', '00:' . strtotime($input->Time));
     if (!$oOutput) {
         $where = array('game_nefub_id' => $parentInput->ID, 'team_nefub_id' => $input->Team->ID, 'game_action_type_id' => $oGameActionType->getId(), 'period' => $input->Period, 'time' => $time);
         $oOutput = GameAction::getSingle($where);
         if (!$oOutput) {
             $oOutput = new GameAction();
         }
     }
     // Mapping
     $oOutput->time = $time;
     $oOutput->period = $input->Period;
     $oOutput->game_nefub_id = $parentInput->ID;
     $oOutput->team_nefub_id = $input->Team->ID;
     $oOutput->game_action_type_id = $oGameActionType->getId();
     $oOutput->code = $input->Code;
     $oOutput->description = $input->Description;
     if ($input->Person) {
         $oOutput->person_nefub_id = $input->Person->ID;
     }
     if ($input->Assist) {
         $oOutput->assist_person_nefub_id = $input->Assist->ID;
     }
     $oOutput->save();
     self::log('GameAction toegevoegd aan Game ' . $oOutput->game_nefub_id);
     return $oOutput;
 }
Ejemplo n.º 2
0
 /**
  * @param mixed $input
  * @param NefubObject $oOutput
  */
 protected static function handleMapping($input, NefubObject $oOutput)
 {
     $oOutput->nefub_id = $input->ID;
     $oOutput->competition_nefub_id = $input->Competition->ID;
     $oOutput->season_nefub_id = Season::getInstance()->nefub_id;
     $oOutput->name = $input->Name;
     $oOutput->information = $input->Information;
     $oPouleType = NefubTypeMapper::mapTypeFromAPI($input->Type, 'PouleType');
     $oOutput->poule_type_id = $oPouleType->getId();
 }
Ejemplo n.º 3
0
 /**
  * @param mixed $input
  * @param NefubObject $oOutput
  */
 protected static function handleMapping($input, NefubObject $oOutput)
 {
     $oOutput->nefub_id = $input->ID;
     $oGenre = NefubTypeMapper::mapTypeFromAPI($input->Genre, 'Genre');
     $oGender = NefubTypeMapper::mapTypeFromAPI($input->Gender, 'Gender');
     $oCompetitionType = NefubTypeMapper::mapTypeFromAPI($input->Type, 'CompetitionType');
     $oOutput->genre_id = $oGenre->getId();
     $oOutput->gender_id = $oGender->getId();
     $oOutput->competition_type_id = $oCompetitionType->getId();
     $aSeasonYears = explode('-', $input->Season);
     $oOutput->season_nefub_id = $aSeasonYears[0];
 }
Ejemplo n.º 4
0
 /**
  * 
  * @param stdClass $gamePerson
  * @param int $teamNefubId
  * @param Game $oGame
  * @return GamePerson
  */
 protected function convertGamePerson(stdClass $gamePerson, $teamNefubId, Game $oGame)
 {
     if (!($oGamePerson = GamePerson::getByNefubId($gamePerson->Person->ID, $oGame->nefub_id))) {
         $oGamePerson = new GamePerson();
         $this->addedNefubObject($oGamePerson);
     }
     $oGamePerson->game_nefub_id = $oGame->nefub_id;
     $oGamePerson->team_nefub_id = $teamNefubId;
     $oGamePerson->person_nefub_id = $gamePerson->Person->ID;
     $oGamePerson->shirt_number = $gamePerson->Number;
     if ($gamePerson->Type) {
         $oType = NefubTypeMapper::mapTypeFromAPI($gamePerson->Type, 'GamePersonSpecialType');
         $oGamePerson->game_person_special_type_id = $oType->getId();
     }
     $oGamePerson->save();
     return $oGamePerson;
 }