Document/Subscriber/RoutableSubscriber.php
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof RoutableBehavior) {
            return;
        }

        $locales = $this->documentInspector->getLocales($document);
        foreach ($locales as $locale) {
            $localizedDocument = $this->documentManager->find($document->getUuid(), $locale);

            $route = $this->routeRepository->findByEntity(
                $localizedDocument->getClass(),
                $localizedDocument->getUuid(),
                $locale
            );
            if (!$route) {
                continue;
            }

            $this->entityManager->remove($route);

            if ($document instanceof ChildrenBehavior) {
                $this->removeChildRoutes($document, $locale);
            }
        }

        $this->entityManager->flush();
    }
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof RoutableBehavior) {
            return;
        }

        $locales = $this->documentInspector->getLocales($document);
        foreach ($locales as $locale) {
            $localizedDocument = $this->documentManager->find($document->getUuid(), $locale);

            $route = $this->routeRepository->findByEntity(
                $localizedDocument->getClass(),
                $localizedDocument->getUuid(),
                $locale
            );
            if (!$route) {
                continue;
            }

            $this->entityManager->remove($route);

            if ($document instanceof ChildrenBehavior) {
                $this->removeChildRoutes($document, $locale);
            }
        }

        $this->entityManager->flush();
    }
public function handleRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof RoutableBehavior ) { return ; } $ locales = $ this -> documentInspector -> getLocales ( $ document ) ; foreach ( $ locales as $ locale ) { $ localizedDocument = $ this -> documentManager -> find ( $ document -> getUuid ( ) , $ locale ) ; $ route = $ this -> routeRepository -> findByEntity ( $ localizedDocument -> getClass ( ) , $ localizedDocument -> getUuid ( ) , $ locale ) ; if ( ! $ route ) { continue ; } $ this -> entityManager -> remove ( $ route ) ; if ( $ document instanceof ChildrenBehavior ) { $ this -> removeChildRoutes ( $ document , $ locale ) ; } } $ this -> entityManager -> flush ( ) ; }
Removes route.

@param RemoveEvent $event
Removes route .