public function preRemove(PageTranslationInterface $translation)
    {
        /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface $translatable */
        $translatable = $translation->getTranslatable();
        if (null !== $parentPage = $translatable->getParent()) {
            $from = $translation->getPath();
            $locale = $translation->getLocale();
            // TODO use url generator or i18n routing prefix strategy
            $localePrefix = $locale != 'fr' ? '/' . $locale : '';

            // Redirect to this parent page.
            $to = $parentPage->translate($locale)->getPath();
            if (0 < strlen($from) && 0 < strlen($to) && $from != $to) {
                $this->redirections[] = array(
                    'from' => $localePrefix . $from,
                    'to'   => $localePrefix . $to,
                );
            }
        }
    }
public function preRemove(PageTranslationInterface $translation)
    {
        /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface $translatable */
        $translatable = $translation->getTranslatable();
        if (null !== $parentPage = $translatable->getParent()) {
            $from = $translation->getPath();
            $locale = $translation->getLocale();
            // TODO use url generator or i18n routing prefix strategy
            $localePrefix = $locale != 'fr' ? '/' . $locale : '';

            // Redirect to this parent page.
            $to = $parentPage->translate($locale)->getPath();
            if (0 < strlen($from) && 0 < strlen($to) && $from != $to) {
                $this->redirections[] = array(
                    'from' => $localePrefix . $from,
                    'to'   => $localePrefix . $to,
                );
            }
        }
    }
public function preRemove ( PageTranslationInterface $ translation ) { /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface $translatable */ $ translatable = $ translation -> getTranslatable ( ) ; if ( null !== $ parentPage = $ translatable -> getParent ( ) ) { $ from = $ translation -> getPath ( ) ; $ locale = $ translation -> getLocale ( ) ; // TODO use url generator or i18n routing prefix strategy $ localePrefix = $ locale != 'fr' ? '/' . $ locale : '' ; // Redirect to this parent page. $ to = $ parentPage -> translate ( $ locale ) -> getPath ( ) ; if ( 0 < strlen ( $ from ) && 0 < strlen ( $ to ) && $ from != $ to ) { $ this -> redirections [ ] = array ( 'from' => $ localePrefix . $ from , 'to' => $ localePrefix . $ to , ) ; } } }
Pre remove event handler.

@param PageTranslationInterface $translation
Pre remove event handler .