src/Kunstmaan/NodeBundle/Helper/NodeMenu.php
private function init()
    {
        if ($this->initialized) {
            return;
        }

        $this->allNodes = array();
        $this->breadCrumb = null;
        $this->childNodes = array();
        $this->topNodeMenuItems = null;
        $this->nodesByInternalName = array();

        /* @var NodeRepository $repo */
        $repo = $this->em->getRepository('KunstmaanNodeBundle:Node');

        // Get all possible menu items in one query (also fetch offline nodes)
        $nodes = $repo->getChildNodes(
            false,
            $this->locale,
            $this->permission,
            $this->aclHelper,
            $this->includeHiddenFromNav,
            true,
            $this->domainConfiguration->getRootNode()
        );
        foreach ($nodes as $node) {
            $this->allNodes[$node->getId()] = $node;

            if ($node->getParent()) {
                $this->childNodes[$node->getParent()->getId()][] = $node;
            } else {
                $this->childNodes[0][] = $node;
            }
            $internalName = $node->getInternalName();
            if ($internalName) {
                $this->nodesByInternalName[$internalName][] = $node;
            }
        }
        $this->initialized = true;
    }
private function init()
    {
        if ($this->initialized) {
            return;
        }

        $this->allNodes = array();
        $this->breadCrumb = null;
        $this->childNodes = array();
        $this->topNodeMenuItems = null;
        $this->nodesByInternalName = array();

        /* @var NodeRepository $repo */
        $repo = $this->em->getRepository('KunstmaanNodeBundle:Node');

        // Get all possible menu items in one query (also fetch offline nodes)
        $nodes = $repo->getChildNodes(
            false,
            $this->locale,
            $this->permission,
            $this->aclHelper,
            $this->includeHiddenFromNav,
            true,
            $this->domainConfiguration->getRootNode()
        );
        foreach ($nodes as $node) {
            $this->allNodes[$node->getId()] = $node;

            if ($node->getParent()) {
                $this->childNodes[$node->getParent()->getId()][] = $node;
            } else {
                $this->childNodes[0][] = $node;
            }
            $internalName = $node->getInternalName();
            if ($internalName) {
                $this->nodesByInternalName[$internalName][] = $node;
            }
        }
        $this->initialized = true;
    }
private function init ( ) { if ( $ this -> initialized ) { return ; } $ this -> allNodes = array ( ) ; $ this -> breadCrumb = null ; $ this -> childNodes = array ( ) ; $ this -> topNodeMenuItems = null ; $ this -> nodesByInternalName = array ( ) ; /* @var NodeRepository $repo */ $ repo = $ this -> em -> getRepository ( 'KunstmaanNodeBundle:Node' ) ; // Get all possible menu items in one query (also fetch offline nodes) $ nodes = $ repo -> getChildNodes ( false , $ this -> locale , $ this -> permission , $ this -> aclHelper , $ this -> includeHiddenFromNav , true , $ this -> domainConfiguration -> getRootNode ( ) ) ; foreach ( $ nodes as $ node ) { $ this -> allNodes [ $ node -> getId ( ) ] = $ node ; if ( $ node -> getParent ( ) ) { $ this -> childNodes [ $ node -> getParent ( ) -> getId ( ) ] [ ] = $ node ; } else { $ this -> childNodes [ 0 ] [ ] = $ node ; } $ internalName = $ node -> getInternalName ( ) ; if ( $ internalName ) { $ this -> nodesByInternalName [ $ internalName ] [ ] = $ node ; } } $ this -> initialized = true ; }
This method initializes the nodemenu only once, the method may be
executed multiple times
This method initializes the nodemenu only once the method may be executed multiple times