private function updateChildrenPageTranslationPath(
        PageInterface $page,
        UnitOfWork $uow,
        ClassMetadata $metadata,
        $from,
        $to,
        $locale
    ) {
        // TODO use url generator or i18n routing prefix strategy
        $localePrefix = $locale != 'fr' ? '/' . $locale : '';
        foreach ($page->getChildren() as $child) {
            $translation = $child->translate($locale);
            $oldPath = $translation->getPath();
            if (0 === strpos($oldPath, $from)) {
                $newPath = str_replace($from, $to, $oldPath);
                $translation->setPath($newPath);
                $uow->recomputeSingleEntityChangeSet($metadata, $translation);

                if (0 < strlen($oldPath) && 0 < strlen($newPath) && $oldPath != $newPath) {
                    $this->redirections[] = array(
                        'from' => $localePrefix . $oldPath,
                        'to'   => $localePrefix . $newPath,
                    );
                }

                // Update the children pages translations paths.
                if ($child->hasChildren()) {
                    $this->updateChildrenPageTranslationPath($child, $uow, $metadata, $oldPath, $newPath, $locale);
                }
            }
        }
    }
private function updateChildrenPageTranslationPath(
        PageInterface $page,
        UnitOfWork $uow,
        ClassMetadata $metadata,
        $from,
        $to,
        $locale
    ) {
        // TODO use url generator or i18n routing prefix strategy
        $localePrefix = $locale != 'fr' ? '/' . $locale : '';
        foreach ($page->getChildren() as $child) {
            $translation = $child->translate($locale);
            $oldPath = $translation->getPath();
            if (0 === strpos($oldPath, $from)) {
                $newPath = str_replace($from, $to, $oldPath);
                $translation->setPath($newPath);
                $uow->recomputeSingleEntityChangeSet($metadata, $translation);

                if (0 < strlen($oldPath) && 0 < strlen($newPath) && $oldPath != $newPath) {
                    $this->redirections[] = array(
                        'from' => $localePrefix . $oldPath,
                        'to'   => $localePrefix . $newPath,
                    );
                }

                // Update the children pages translations paths.
                if ($child->hasChildren()) {
                    $this->updateChildrenPageTranslationPath($child, $uow, $metadata, $oldPath, $newPath, $locale);
                }
            }
        }
    }
private function updateChildrenPageTranslationPath ( PageInterface $ page , UnitOfWork $ uow , ClassMetadata $ metadata , $ from , $ to , $ locale ) { // TODO use url generator or i18n routing prefix strategy $ localePrefix = $ locale != 'fr' ? '/' . $ locale : '' ; foreach ( $ page -> getChildren ( ) as $ child ) { $ translation = $ child -> translate ( $ locale ) ; $ oldPath = $ translation -> getPath ( ) ; if ( 0 === strpos ( $ oldPath , $ from ) ) { $ newPath = str_replace ( $ from , $ to , $ oldPath ) ; $ translation -> setPath ( $ newPath ) ; $ uow -> recomputeSingleEntityChangeSet ( $ metadata , $ translation ) ; if ( 0 < strlen ( $ oldPath ) && 0 < strlen ( $ newPath ) && $ oldPath != $ newPath ) { $ this -> redirections [ ] = array ( 'from' => $ localePrefix . $ oldPath , 'to' => $ localePrefix . $ newPath , ) ; } // Update the children pages translations paths. if ( $ child -> hasChildren ( ) ) { $ this -> updateChildrenPageTranslationPath ( $ child , $ uow , $ metadata , $ oldPath , $ newPath , $ locale ) ; } } } }
Updates the page children translation path recursively.

@param PageInterface $page
@param UnitOfWork    $uow
@param ClassMetadata $metadata
@param string        $from
@param string        $to
@param string        $locale
Updates the page children translation path recursively .