src/Kunstmaan/NodeBundle/EventListener/NodeTranslationListener.php
private function updateNodeChildren(NodeTranslation $node, EntityManagerInterface $em, ClassMetadata $class)
    {
        $children = $node->getNode()->getChildren();
        if (\count($children) > 0) {
            /* @var Node $child */
            foreach ($children as $child) {
                $translation = $child->getNodeTranslation($node->getLang(), true);
                if ($translation) {
                    $translation = $this->updateUrl($translation, $em);

                    if ($translation !== false) {
                        $em->persist($translation);
                        $em->getUnitOfWork()->recomputeSingleEntityChangeSet($class, $translation);

                        $this->updateNodeChildren($translation, $em, $class);
                    }
                }
            }
        }
    }
private function updateNodeChildren(NodeTranslation $node, EntityManagerInterface $em, ClassMetadata $class)
    {
        $children = $node->getNode()->getChildren();
        if (\count($children) > 0) {
            /* @var Node $child */
            foreach ($children as $child) {
                $translation = $child->getNodeTranslation($node->getLang(), true);
                if ($translation) {
                    $translation = $this->updateUrl($translation, $em);

                    if ($translation !== false) {
                        $em->persist($translation);
                        $em->getUnitOfWork()->recomputeSingleEntityChangeSet($class, $translation);

                        $this->updateNodeChildren($translation, $em, $class);
                    }
                }
            }
        }
    }
private function updateNodeChildren ( NodeTranslation $ node , EntityManagerInterface $ em , ClassMetadata $ class ) { $ children = $ node -> getNode ( ) -> getChildren ( ) ; if ( \ count ( $ children ) > 0 ) { /* @var Node $child */ foreach ( $ children as $ child ) { $ translation = $ child -> getNodeTranslation ( $ node -> getLang ( ) , true ) ; if ( $ translation ) { $ translation = $ this -> updateUrl ( $ translation , $ em ) ; if ( $ translation !== false ) { $ em -> persist ( $ translation ) ; $ em -> getUnitOfWork ( ) -> recomputeSingleEntityChangeSet ( $ class , $ translation ) ; $ this -> updateNodeChildren ( $ translation , $ em , $ class ) ; } } } } }
Checks if a nodetranslation has children and update their url

@param NodeTranslation        $node  The node
@param EntityManagerInterface $em    The entity manager
@param ClassMetadata          $class The class meta daat
Checks if a nodetranslation has children and update their url