/** * @param PersonCategory $personCategory * @return PersonCategoryListDTO */ public function personCategorysToPersonCategoryListDTO(PersonCategory $personCategory) { $personCategoryEmbeddedListDTO = new PersonCategoryListDTO(); $personCategoryEmbeddedListDTO->id = $personCategory->getId(); $personCategoryEmbeddedListDTO->name = $personCategory->getName(); return $personCategoryEmbeddedListDTO; }
/** * @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; }