/** * @param mixed $input * @param NefubObject $oOutput */ protected static function handleMapping($input, NefubObject $oOutput) { $oOutput->nefub_id = $input->ID; $oOutput->name = $input->Name; if (isset($input->Competitions) && is_array($input->Competitions)) { foreach ($input->Competitions as $pouleInput) { CompetitionMapper::mapFromAPI($pouleInput); } } }
/** * * @param stdClass $team * @param int $seasonNefubId * @return Team */ private function convertTeam(stdClass $team) { $oTeam = Team::getByNefubID($team->ID); if (!$oTeam) { $oTeam = new Team(); $oTeam->nefub_id = $team->ID; $this->addedNefubObject($oTeam); } $oTeam->name = $team->Name; $oTeam->color_shirt = $team->Dress->Shirt; $oTeam->color_shorts = $team->Dress->Short; $oTeam->club_nefub_id = $team->Club->ID; $oCompetition = CompetitionMapper::mapFromAPI($team->Competition); $oTeam->competition_nefub_id = $oCompetition->nefub_id; $oTeam->season_nefub_id = Season::getInstance()->nefub_id; $oTeam->save(); self::put('Update statistieken van spelers in team ' . $oTeam->name); if (isset($team->Players)) { foreach ($team->Players as $teamPerson) { $this->convertTeamPerson($teamPerson, $oTeam); } } if (isset($team->Poules)) { foreach ($team->Poules as $pouleTeam) { $this->convertPouleTeam($pouleTeam, $oTeam); } } $oTeam->save(); return $oTeam; }