Add a MbPage to MocaBonita as main menu

@param MbPage $mbPage

@return MocaBonita current instance of MocaBonita
13676
public function addMbPage(MbPage $mbPage)
    {
        $mbPage->setSubMenu(false);

        $mbPage->setMainMenu(true);

        $this->mbPages->put($mbPage->getSlug(), $mbPage);

        foreach ($mbPage->getSubPages() as $subPage) {
            $this->addSubMbPage($subPage);
            $subPage->setParentPage($mbPage);
        }

        return $this;
    }
408428
public function setPage($page)
    {
        $this->stateChanged = true;
        $path = $this->prefixWithNamespace('page');
        $this->argumentsAccessor->set($path, $page);
        return $this;
    }
461421
public function page(int $page)
    {
        $this->page = $page ? $page : $this->page;

        return $this;
    }
322050
private function updatePageMenuPosition(Page $page)
    {
        $pageMenuRepository = $this->doctrine->getRepository('FulgurioLightCMSBundle:PageMenu');
        $em = $this->doctrine->getManager();
        $data = $this->request->get('page');
        if (isset($data['availableMenu']))
        {
            if (!is_null($page->getId()))
            {
                $menus = $page->getMenu();
                $alreadyInMenu = array();
                foreach ($menus as $menu)
                {
                    if (!in_array($menu->getLabel(), $data['availableMenu']))
                    {
                        $pageMenuRepository->upMenuPagesPosition($menu->getLabel(), $menu->getPosition() + 1);
                        $em->remove($menu);
                    }
                    else
                    {
                        $alreadyInMenu[] = $menu->getLabel();
                    }
                }
            }
            foreach ($data['availableMenu'] as $menuLabel)
            {
                // If it s a new page, or if it a page which we had a new menu
                if (!isset($alreadyInMenu) || !in_array($menuLabel, $alreadyInMenu))
                {
                    $menu = new PageMenu();
                    $menu->setPosition($pageMenuRepository->getNextMenuPosition($menuLabel));
                    $menu->setLabel($menuLabel);
                    $menu->setPage($page);
                    $em->persist($menu);
                }
            }
        }
        else if (!is_null($page->getId()))
        {
            $menus = $page->getMenu();
            foreach ($menus as $menu)
            {
                $pageMenuRepository->upMenuPagesPosition($menu->getLabel(), $menu->getPosition() + 1);
                $em->remove($menu);
            }
        }
    }
1144053
public function setPage(\Amulen\PageBundle\Entity\Page $page = null) {
        $this->page = $page;

        return $this;
    }
914740
public function setMenuPage(\Core\Entity\MenuPage $menuPage = null)
    {
        $this->menuPage = $menuPage;

        return $this;
    }
271167
public function setPage(Page $page)
    {
        $this->_page = $page;
        $page->setMainSection($this);

        return $this;
    }
354912
public function addForm(FormBuilderInterface $fb, Page $page)
    {
        $data = $page->getData() == "" ? 0 : $page->getData();
        $fb->add('mode', ChoiceType::class,[
            "label" => "sitemap.behavior",
            "translation_domain" => "forms",
            "choices" => [
                "sitemap.absolute" => 0,
                "sitemap.relative" => 1,
                "sitemap.subpages" => 2,
            ],
            "data" => $data["mode"],
            "mapped" => false
        ])
            ->add("limit", NumberType::class, [
                "label" => "sitemap.limit",
                "translation_domain" => "forms",
                "mapped" => false,
                "data" => $data["limit"],
                "required" => false
            ]);
        return $fb;
    }
300815
public function setPage($page)
    {
        if ($page < 1) {
            $page = 1;
        }

        if ($this->range == 0) {
            $this->setRange(25);
        }

        $this->start = ($page - 1) * $this->range;

        return $this;
    }
556596
public function page($page = null)
    {
        if (isset($page)) {
            $this->setPage($page);

            return $this;
        }

        return $this->getPage();
    }
484192
public function setPage($page) {
        if (!is_numeric($page)) {
            $page = self::DEFAULT_PAGE;
        }

        if (0 == $page) {
            $page = self::DEFAULT_PAGE;
        }

        $this->page = $page;

        return $this;
    }
974985
public function create(Page $page)
    {
        $model = $this->repository->createModel();

        return view('pages::admin.create-section')
            ->with(compact('model', 'page'));
    }
517811
public function addTabURL($page, $title = null)
    {
        if (is_null($title)) {
            $title = ucwords(preg_replace('/[_\/\.]+/', ' ', $page));
        }
        $this->tab_template->set(array(
                    'url' => $this->app->url($page, array('cut_page' => 1)),
                    'tab_name' => $title,
                    'tab_id' => basename($page),
                    ));
        $this->template->appendHTML('tabs', $this->tab_template->render());

        return $this;
    }
791004
public function addPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)
    {
        return parent::AddPage($orientation, $format, $keepmargins, $tocpage);
    }
428054
public function resolve(Page $page = null)
    {
        if (null === $page || (null === $metadataBag = $page->getMetaData())) {
            $metadataBag = new MetaDataBag();
        }

        if (!is_array($this->definitions)) {
            return $metadataBag;
        }

        foreach ($this->definitions as $name => $definition) {
            if (!is_array($definition)) {
                continue;
            }

            if (null === $metadata = $metadataBag->get($name)) {
                $metadata = new MetaData($name);
                $metadataBag->add($metadata);
            }

            $this->parseDefinition($definition, $metadata, $page);
        }

        return clone $metadataBag;
    }
895729
public function fromPage(Page $page, $nameField = 'MenuTitle')
    {
        $this->Title = $page->{$nameField};
        $this->LinkTo = LinkToExtension::MODE_PAGE;
        $this->LinkPageID = $page->ID;
        
        return $this;
    }
620482
public function paginate($page, $perPage = 30)
	{
		$this->set('from', max(0, $perPage * ($page - 1)));
		$this->set('size', $perPage);

		return $this;
	}