Bundle/PageBundle/Helper/PageHelper.php
public function setPosition(BasePage $page)
    {
        if ($page->getParent()) {
            $pageNb = count($page->getParent()->getChildren());
        } else {
            $pageNb = count($this->entityManager->getRepository('VictoirePageBundle:BasePage')->findByParent(null));
        }

        // + 1 because position start at 1, not 0
        $page->setPosition($pageNb + 1);

        return $page;
    }
public function setPosition(BasePage $page)
    {
        if ($page->getParent()) {
            $pageNb = count($page->getParent()->getChildren());
        } else {
            $pageNb = count($this->entityManager->getRepository('VictoirePageBundle:BasePage')->findByParent(null));
        }

        // + 1 because position start at 1, not 0
        $page->setPosition($pageNb + 1);

        return $page;
    }
public function setPosition ( BasePage $ page ) { if ( $ page -> getParent ( ) ) { $ pageNb = count ( $ page -> getParent ( ) -> getChildren ( ) ) ; } else { $ pageNb = count ( $ this -> entityManager -> getRepository ( 'VictoirePageBundle:BasePage' ) -> findByParent ( null ) ) ; } // + 1 because position start at 1, not 0 $ page -> setPosition ( $ pageNb + 1 ) ; return $ page ; }
Set Page position.

@param BasePage $page

@return BasePage $page
Set Page position .