Delete a Page.
Route is defined in inherited controllers.

@param BasePage $page

@return array
972604
protected function deleteAction(BasePage $page)
    {
        try {
            //Throw Exception if Page is undeletable
            if ($page->isUndeletable()) {
                $message = $this->get('translator')->trans('page.undeletable', [], 'victoire');

                throw new \Exception($message);
            }

            $entityManager = $this->get('doctrine.orm.entity_manager');
            $entityManager->remove($page);
            $entityManager->flush();

            return [
                'success' => true,
                'url'     => $this->generateUrl('victoire_core_homepage_show'),
            ];
        } catch (\Exception $ex) {
            return [
                'success' => false,
                'message' => $ex->getMessage(),
            ];
        }
    }
906262
private static function page($page, array $details)
    {
        if(($page === '*' && is_page()) || is_page($page))
        {
            self::loadController($details);
            exit;
        }
    }
1254046
public function getAdminPageBaseQuery($tab, $page)
    {
        if (!isset($this->tabs[$tab])) {
            throw new \RuntimeException("content admin tab '%s' does not exist", $tab);
        }
        if (!isset($this->adminPages[$page])) {
            throw new \RuntimeException("content admin page '%s' does not exist", $page);
        }

        if (isset($this->adminPages[$page]['base_query'])) {
            $baseQuery = $this->adminPages[$page]['base_query'];
        } else {
            $baseQuery = [];
        }

        switch ($tab) {

            case 'content':
                $baseQuery['type'] = $this->getContentTypes();
                break;

            case 'media':
                $baseQuery['type'] = $this->getMediaTypes();
                break;

            default:
                throw new \RuntimeException("only 'content' and 'media' tabs are supported as of now", $page);
        }

        return $baseQuery;
    }
1050404
public static function delete(Route $route)
    {
        $routeWithoutSlash = $route;
        $routeWithSlash = $route->getWithSlash();

        // exception_if(! check(self::$register[$routeWithoutSlash->getName()]), RouteNotFoundInRoutesRegisterException::class , $routeWithoutSlash);
        // exception_if(! check(self::$register[$routeWithSlash->getName()]), RouteNotFoundInRoutesRegisterException::class , $routeWithSlash);

        if (check(self::$register[$routeWithoutSlash->getName()])) {
            unset(self::$register[$routeWithoutSlash->getName()]);
        }

        if (check(self::$register[$routeWithSlash->getName()])) {
            unset(self::$register[$routeWithSlash->getName()]);
        }
    }
355392
public function delete($id)
    {
        $this->request->allowMethod('post');

        /** @var Page $page */
        $page = $this->Pages->get($id);

        if ($this->Pages->delete($page)) {
            $this->Flash->success(__d('wasabi_cms', 'The page <strong>{0}</strong> has been deleted.', $page->name));
        } else {
            $this->Flash->error($this->dbErrorMessage);
        }

        $this->redirect(['action' => 'index']);
        return;
    }
1067766
protected function isPageStandard(Page $page)
    {
        $result = false;
        if (!$page->isError() && !$page->isSystemPage() && !$page->isExternalLink() && !$page->isMasterCollection() && !$page->isInTrash()) {
            if (!$this->getDashboardHelper()->inDashboard($page)) {
                $result = true;
            }
        }

        return $result;
    }
700306
public function deletePage($page_id)
    {
        try {
            return json_decode($this->getClient()->delete('content/' . $page_id)->getBody(), true);
        } catch (BadResponseException $e) {
            throw $this->handleError($e);
        }
    }
661941
private static function getInstanceForPage(TdbCmsTplPage $page, $baseQuery)
    {
        /** @var CacheInterface $cache */
        $cache = \ChameleonSystem\CoreBundle\ServiceLocator::get('chameleon_system_core.cache');

        $cacheKey = $cache->getKey(array(
            'class' => __CLASS__,
            'method' => 'getInstanceForPage',
            'pageId' => $page->id,
        ));
        $instance = $cache->get($cacheKey);
        if (null === $instance) {
            $instance = false;

            $query = "SELECT pkg_shop_listfilter_module_config.*
                    FROM cms_tpl_module_instance
              INNER JOIN cms_tpl_module ON cms_tpl_module_instance.cms_tpl_module_id = cms_tpl_module.id
              INNER JOIN cms_tpl_page_cms_master_pagedef_spot ON cms_tpl_module_instance.id = cms_tpl_page_cms_master_pagedef_spot.cms_tpl_module_instance_id
              INNER JOIN pkg_shop_listfilter_module_config ON cms_tpl_module_instance.id = pkg_shop_listfilter_module_config.cms_tpl_module_instance_id
                   WHERE cms_tpl_page_cms_master_pagedef_spot.cms_tpl_page_id = '{$page->id}'
                     AND pkg_shop_listfilter_module_config.pkg_shop_listfilter_id != ''

        ";

            // we are looking for a module that has a listfilter set. in the future we might change this to a more robust way of identifying the right module. (eg. via generic meta data)
            $filterConfig = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
            if ($filterConfig) {
                $instance = TdbPkgShopListfilter::GetNewInstance($filterConfig['pkg_shop_listfilter_id']);
                if ('' !== $filterConfig['filter_parameter']) {
                    $instance->setStaticFilter($filterConfig['filter_parameter']);
                }
            }

            $cache->set($cacheKey, $instance, array(array('table' => 'shop', 'id' => null), array('table' => 'cms_tpl_page', 'id' => $page->id), array('table' => 'pkg_shop_listfilter', 'id' => null)));
        }

        if (false === $instance) { // check if the category sets a filter
            $instance = null;
            /** @var $shopService \ChameleonSystem\ShopBundle\Interfaces\ShopServiceInterface */
            $shopService = \ChameleonSystem\CoreBundle\ServiceLocator::get('chameleon_system_shop.shop_service');
            $activeCategory = $shopService->getActiveCategory();
            if (null !== $activeCategory) {
                $instance = self::getInstanceForCategory($activeCategory, $shopService->getActiveShop());
            }
        }

        if (null === $instance) {
            $instance = TdbPkgShopListfilter::GetNewInstance(TdbShop::GetInstance()->fieldPkgShopListfilterPostsearchId);
        }

        $instance->pushStaticFilterToRequest();

        $instance->setArticleListQuery($baseQuery);

        return $instance;
    }
472655
public function clearCache($pages){
        if(!is_array($pages)){
            $pages = [$pages];
        }
        foreach($pages as $page){
            foreach($this->config->getDomain("type") as $type => $cacheLvl){
                $cacheLvl = abs($cacheLvl);
                if($cacheLvl == self::NO_CACHE) continue;
                $type = $this->em->getRepository(PageType::class)->findOneByTitle(str_replace("type.","",$type));
                $pagesToClear = $this->em->getRepository(Page::class)->findByType($type);
                switch($cacheLvl){
                    case self::TEMPORARY:
                        foreach($pagesToClear as $pageToClear){
                            $this->clearPage($pageToClear);
                        }
                        break;
                    case self::CHILDREN_DEPENDENCE:
                        foreach($pagesToClear as $p){
                            if(in_array($page, $p->getSubPages()->toArray())){
                                $this->clearPage($p);
                            }
                        }
                        break;
                }

                $uri = $this->config->get("URIs","uri.".$page->getRootPage()->getId());
                $this->removeUrl($uri, $page->getLink());
            }
        }
    }
1291475
@Override
  public void deletePage(int pageID) {
    try {
      // / put id to empty nodes and
      // delete from cache
      super.deletePage(pageID);

      // delete from file
      countWrite();
      byte[] array = pageToByteArray(null);
      file.getRecordBuffer(pageID).put(array);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
1228482
private function handlePage(PageInterface $page)
    {
        $doRecompute = false;

        $dynamicPath = $this->hasDynamicPath($page);
        if ($dynamicPath != $page->isDynamicPath()) {
            $page->setDynamicPath($dynamicPath);
            $doRecompute = true;
        }

        $advanced = $this->isAdvanced($page);
        if (null !== $advanced && $advanced != $page->isAdvanced()) {
            $page->setAdvanced($advanced);
            $doRecompute = true;
        }

        return $doRecompute;
    }
459699
public function __HANDLER($page = null)
    {
        $parent = CMSNav::fullTree();
        $tree = new \samson\treeview\SamsonTree('tree/tree-template', 0, 'structure/addchildren');

        // Установим дерево ЭСС
        m()->view('index')
            ->title(t('Элементы структуры содержания сайта', true))
            ->set($tree->htmlTree($parent), 'tree');
    }
1004443
public function revokePagePrivileges(Page $page)
    {
        if ($this->revokePageStatement == null) {
            $this->revokePageStatement =
                $this->connection->prepare("DELETE FROM UserPrivileges WHERE username = ? AND pageId = ?");
        }
        $this->revokePageStatement->execute(array($this->user->getUsername(), $page->getID()));
        unset($this->pagePrivilege[$page->getID()]);
    }
1209733
public function forget($page)
    {
        if ($page = $this->getPage($page)) {
            /** @todo Implement forgetting pages completely */

            /** @var Connection $database */
            $database = $this->app['database']->connection();
            $database->executeQuery('DELETE FROM PageSearchIndex WHERE cID=?', [$page->getCollectionID()]);
        }

        return false;
    }
1092735
public function render_data_deletion_page(data_deletion_page $page) {
        $data = $page->export_for_template($this);
        return parent::render_from_template('tool_dataprivacy/data_deletion', $data);
    }
55006
public function removePage(Page $page): Category
    {
        $this->children->removeElement($page);

        $page->setCategory(null);

        return $this;
    }
42811
public function deletePage(Page $page)
    {
        $findPage = $this->findPage($page);
        if ($findPage === false) {
            return false;
        }

        $deleteStm = $this->connection->prepare("DELETE FROM Page WHERE page_id=?");
        $deleteStm->execute([$page->getID()]);
        if (!$deleteStm->rowCount() > 0) {
            return false;
        }
        if ($findPage == 'active') {
            unset($this->activePages[$page->getID()]);
        } else {
            unset($this->inactivePages[$page->getID()]);
        }

        return true;
    }