private function disablePageRelativeMenus(PageInterface $page)
    {
        $disabledMenus = false;
        if (!$page->isEnabled()) {

            // Disable menu children query
            $disableChildrenQuery = $this->em->createQuery(sprintf(
                'UPDATE %s m SET m.enabled = 0 WHERE m.root = :root AND m.left > :left AND m.right < :right',
                $this->menuClass
            ));

            // Disable pointing menus
            /** @var \Ekyna\Bundle\CmsBundle\Model\MenuInterface[] $menus */
            $menus = $this->em
                ->createQuery("SELECT m FROM {$this->menuClass} m WHERE m.route = :route")
                ->setParameter('route', $page->getRoute())
                ->getResult();
            if (!empty($menus)) {
                foreach ($menus as $menu) {
                    if ($menu->isEnabled()) {
                        $menu->setEnabled(false);
                        $this->em->persist($menu);
                        $disabledMenus = true;

                        $disableChildrenQuery->execute(array(
                            'root'  => $menu->getRoot(),
                            'left'  => $menu->getLeft(),
                            'right' => $menu->getRight(),
                        ));
                    }
                }
            }
        }
        return $disabledMenus;
    }
private function disablePageRelativeMenus(PageInterface $page)
    {
        $disabledMenus = false;
        if (!$page->isEnabled()) {

            // Disable menu children query
            $disableChildrenQuery = $this->em->createQuery(sprintf(
                'UPDATE %s m SET m.enabled = 0 WHERE m.root = :root AND m.left > :left AND m.right < :right',
                $this->menuClass
            ));

            // Disable pointing menus
            /** @var \Ekyna\Bundle\CmsBundle\Model\MenuInterface[] $menus */
            $menus = $this->em
                ->createQuery("SELECT m FROM {$this->menuClass} m WHERE m.route = :route")
                ->setParameter('route', $page->getRoute())
                ->getResult();
            if (!empty($menus)) {
                foreach ($menus as $menu) {
                    if ($menu->isEnabled()) {
                        $menu->setEnabled(false);
                        $this->em->persist($menu);
                        $disabledMenus = true;

                        $disableChildrenQuery->execute(array(
                            'root'  => $menu->getRoot(),
                            'left'  => $menu->getLeft(),
                            'right' => $menu->getRight(),
                        ));
                    }
                }
            }
        }
        return $disabledMenus;
    }
private function disablePageRelativeMenus ( PageInterface $ page ) { $ disabledMenus = false ; if ( ! $ page -> isEnabled ( ) ) { // Disable menu children query $ disableChildrenQuery = $ this -> em -> createQuery ( sprintf ( 'UPDATE %s m SET m.enabled = 0 WHERE m.root = :root AND m.left > :left AND m.right < :right' , $ this -> menuClass ) ) ; // Disable pointing menus /** @var \Ekyna\Bundle\CmsBundle\Model\MenuInterface[] $menus */ $ menus = $ this -> em -> createQuery ( "SELECT m FROM {$this->menuClass} m WHERE m.route = :route" ) -> setParameter ( 'route' , $ page -> getRoute ( ) ) -> getResult ( ) ; if ( ! empty ( $ menus ) ) { foreach ( $ menus as $ menu ) { if ( $ menu -> isEnabled ( ) ) { $ menu -> setEnabled ( false ) ; $ this -> em -> persist ( $ menu ) ; $ disabledMenus = true ; $ disableChildrenQuery -> execute ( array ( 'root' => $ menu -> getRoot ( ) , 'left' => $ menu -> getLeft ( ) , 'right' => $ menu -> getRight ( ) , ) ) ; } } } } return $ disabledMenus ; }
Disable the page relative menus if needed.

@param PageInterface $page

@return bool
Disable the page relative menus if needed .