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