/** * @param PersonCategory $personCategory * @return PersonCategoryListDTO */ public function personCategorysToPersonCategoryListDTO(PersonCategory $personCategory) { $personCategoryEmbeddedListDTO = new PersonCategoryListDTO(); $personCategoryEmbeddedListDTO->id = $personCategory->getId(); $personCategoryEmbeddedListDTO->name = $personCategory->getName(); return $personCategoryEmbeddedListDTO; }
/** * @param $name * @param null $memo * @return PersonCategory */ public static function registerPersonCategory($name, $memo = null) { $personCategory = new PersonCategory(); $personCategory->setName($name); $personCategory->setMemo($memo); return $personCategory; }
/** * @param PersonCategory $personCategory * @return PersonCategory */ public function storeAndGetPersonCategory(PersonCategory $personCategory) { $current = $this->findOneBy(array('name' => $personCategory->getName())); if (empty($current)) { $this->getEntityManager()->persist($personCategory); return $personCategory; } return $current; }
private function createPersonCategory($name) { $category = PersonCategory::registerPersonCategory($name); $current = $this->init->personCategoryRepo->findOneBy(array('name' => $name)); if (empty($current)) { $this->init->personCategoryRepo->store($category); return $category; } return $current; }