/** * @param Handicap $handicap * @return HandicapListDTO */ public function toHandicapListDTO(Handicap $handicap) { $handicapListDTO = new HandicapListDTO(); $handicapListDTO->id = $handicap->getId(); $handicapListDTO->name = $handicap->getName(); return $handicapListDTO; }
/** * @param $name * @param null $memo * @return Handicap */ public static function registerHandicap($name, $memo = null) { $handicap = new Handicap(); $handicap->setName($name); $handicap->setMemo($memo); return $handicap; }
private function createHandicap($name) { $handicap = Handicap::registerHandicap($name); $current = $this->init->handicapRepo->findOneBy(array('name' => $name)); if (empty($current)) { $this->init->handicapRepo->store($handicap); return $handicap; } return $current; }