delete() публичный Метод

Removes keyword from given category.
public delete ( Sulu\Bundle\CategoryBundle\Entity\KeywordInterface $keyword, Sulu\Bundle\CategoryBundle\Entity\CategoryInterface $category ) : boolean
$keyword Sulu\Bundle\CategoryBundle\Entity\KeywordInterface
$category Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
Результат boolean true if keyword is deleted completely from the database otherwise only from the category
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function delete($id)
 {
     if (!($entity = $this->categoryRepository->findCategoryById($id))) {
         throw new CategoryIdNotFoundException($id);
     }
     foreach ($entity->getTranslations() as $translation) {
         /** @var CategoryTranslationInterface $translation */
         foreach ($translation->getKeywords() as $keyword) {
             $this->keywordManager->delete($keyword, $entity);
         }
     }
     $this->em->remove($entity);
     $this->em->flush();
     // throw a category.delete event
     $event = new CategoryDeleteEvent($entity);
     $this->eventDispatcher->dispatch(CategoryEvents::CATEGORY_DELETE, $event);
 }