typeRepository = $typeRepository; } public function createAction(string $title) { $type = $this->typeRepository->findByTitle($title); if(!$type && $type !== ''){ $type = new Type(); $type->setTitle($title); $this->typeRepository->add($type); $this->objectManager->get(PersistenceManager::class)->persistAll(); $typeUid = $type->getUid(); } else { $typeUid = $type['uid']; } return $typeUid; } }