public static function loadFromDb(DbEntry $reservation) { $instance = new Reservation(); $instance->setId($reservation->id); $instance->setReleaseDate($reservation->release_date); $instance->setPublishedAt($reservation->published_at); if ($reservation->last_modified_at) { $instance->setLastModifiedAt($reservation->last_modified_at); } $instance->setHomeTeam(TeamService::loadFromDb($reservation->home_team)); $instance->setAwayTeam(TeamService::loadFromDb($reservation->away_team)); $instance->setUser(UserService::loadFromDb($reservation->user)); return $instance; }
private function toEntity(DbEntry $team) { return TeamService::loadFromDb($team); }