@param Request     $request
@param string      $identifier
@param string      $pagedef
@param string|null $catid

@return Response
434201
public function shopArticle(Request $request, $identifier, $pagedef, $catid = null)
    {
        $queryParameter = $request->query->all();
        if (isset($queryParameter[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY])) {
            unset($queryParameter[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]);
        }
        if (0 === count($queryParameter)) {
            $queryParameter = null;
        }

        $cmsident = $identifier;

        $variantSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
        $aKey = array('class' => __CLASS__, 'fnc' => 'shopArticle', 'catid' => $catid, 'cmsident' => $cmsident, 'variantSelection' => $variantSelection);
        $cache = $this->getCache();
        $key = $cache->getKey($aKey);

        $aResponse = $cache->get($key);
        if (null !== $aResponse) {
            $aResponse['queryParameter'] = $queryParameter;
            // check if we need a redirect

            if (!isset($aResponse['activeShopArticle']) || null === $aResponse['activeShopArticle']) {
                return $this->processArticleResponse($aResponse, null);
            }

            $realItemURL = (isset($aResponse['fullURL'])) ? $aResponse['fullURL'] : $request->getPathInfo();
            if ($realItemURL !== $request->getPathInfo()) {
                $aResponse['redirectURL'] = $realItemURL;
                $aResponse['redirectPermanent'] = true;
            }

            return $this->processArticleResponse($aResponse, $request);
        }

        $aResponse = array(
            'activeShopArticle' => null,
            'activeShopCategory' => null,
            'redirectURL' => null,
            'redirectPermanent' => false,
            'fullURL' => null,
            'noMatch' => false,
            'pagedef' => $pagedef,
            'queryParameter' => $queryParameter,
        );

        $article = $this->createArticleFromIdentificationToken($cmsident);
        if (null === $article) {
            $aResponse['noMatch'] = true;

            return $this->processArticleResponse($aResponse, $request, $key);
        }

        if (false === $article->AllowDetailviewInShop()) {
            $aResponse = $this->prepareArticleResponseWhenDetailViewNotAllowed($aResponse, $article, $catid);

            return $this->processArticleResponse($aResponse, $request, $key);
        }

        $category = $this->getValidCategoryForArticle($catid, $article);

        if (null === $category && null !== $article->GetPrimaryCategory()) {
            $currentArticlePath = $article->getLink(false);
            $requestedPath = $request->getPathInfo();
            if ($requestedPath !== $currentArticlePath) {
                $aResponse['redirectURL'] = $article->getLink(true);
                $aResponse['fullURL'] = $aResponse['redirectURL'];
                $aResponse['redirectPermanent'] = true;
            }

            return $this->processArticleResponse($aResponse, $request, $key);
        }

        $variantArticle = $article;
        if (!is_null($article) && (false !== $variantSelection || false === $article->IsVariant())) {
            $variantArticle = TdbShop::GetActiveItemVariant($article);
        }

        $realItemURL = $this->getArticleFullUrlForRequest($category, $variantArticle);
        $aResponse['fullURL'] = $realItemURL;
        $currentFullURL = $request->getPathInfo();
        if ($realItemURL !== $currentFullURL && $variantArticle->AllowDetailviewInShop()) {
            $aResponse['redirectURL'] = $realItemURL;
            $aResponse['redirectPermanent'] = true;
        }
        $article = $variantArticle;

        $aResponse['activeShopArticle'] = $article;
        if (null !== $category) {
            $aResponse['activeShopCategory'] = $category;
        }

        return $this->processArticleResponse($aResponse, $request, $key);
    }
303824
public function getWebhook($identifier) {
        $response = $this->blocktrailClient->get("webhook/".$identifier);
        return self::jsonDecode($response->body(), true);
    }
1206780
public function postAction(Request $request, $parentId)
    {
        $requestData = $request->request->all();
        $userId = $this->getUser()->getId();
        $locale = $this->getLocale($request);

        $variant = $this->getProductVariantManager()->createVariant(
            $parentId,
            $requestData,
            $locale,
            $userId
        );

        $this->getEntityManager()->flush();

        $apiVariant = $this->getProductFactory()->createApiEntity($variant, $locale);

        $view = $this->view($apiVariant, 200);

        return $this->handleView($view);
    }
320545
public function handleRequest(TableInterface $table, Request $request)
    {
        // execute query with filters
        $rows = $this->getRows($table, $request);

        // params for twig parts
        $twigParams = array(
            'table' => $table,
            'rows' => $rows,
        );

        $template = $this->twig->loadTemplate($table->getTemplate());

        $responseParams = array(
            'page' => $table->getPage(),
            'rowsPerPage' => $table->getRowsPerPage(),
            'totalRows' => $table->getTotalRows(),
            'filteredRows' => $table->getFilteredRows(),
            'lastPage' => $table->getLastPage(),
            'tableBody' => $template->renderBlock(
                'tableBody',
                array_merge($twigParams, array('tableRenderBody' => true), $table->getTemplateParams())
            ),
            //"tableFoot"=>$template->renderBlock("tableFoot", $twigParams),
            'tableStats' => $template->renderBlock(
                'tableStatsAjax',
                array_merge($twigParams, array('tableRenderStats' => true))
            ),
            'tablePagination' => $template->renderBlock(
                'tablePaginationAjax',
                array_merge($twigParams, array('tableRenderPagination' => true))
            ),
        );

        // encode response
        $response = new Response(json_encode($responseParams));

        return $response;
    }
416393
private void addEntityID(Map<String, String> requestParameters, StringBuilder uri) {
        if (StringUtils.hasText(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID))) {
            uri.append("/").append(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID));
        }
    }
709273
private function generate(
        string $identifier,
        string $method,
        string $timestamp,
        string $uri,
        string $content
    ) : string {
        $payload = [
            'id' => $identifier,
            'method' => strtoupper($method),
            'timestamp' => $timestamp,
            'uri' => rtrim($uri, '/')
        ];

        if (is_null(json_decode($content))) {
            $payload = array_merge($payload, [
                'content' => $content
            ]);
        } else {
            $payload = array_merge($payload, [
                'content' => json_encode(
                    json_decode($content),
                    JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
                )
            ]);
        }

        return json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    }
156750
public function showBusinessPageByIdAction(Request $request, $entityId, $type)
    {
        $businessEntityHelper = $this->get('victoire_core.helper.queriable_business_entity_helper');
        $businessEntity = $businessEntityHelper->findById($type);
        $entity = $businessEntityHelper->getByBusinessEntityAndId($businessEntity, $entityId);

        $refClass = new \ReflectionClass($entity);

        $templateId = $this->get('victoire_business_page.business_page_helper')
            ->guessBestPatternIdForEntity($refClass, $entityId, $this->container->get('doctrine.orm.entity_manager'));

        $page = $this->get('victoire_page.page_helper')->findPageByParameters([
            'viewId'   => $templateId,
            'entityId' => $entityId,
            'locale'   => $request->getLocale(),
        ]);

        return $this->redirect(
            $this->generateUrl(
                'victoire_core_page_show',
                [
                    'url' => $page->getReference()->getUrl(),
                ]
            )
        );
    }
800440
public function deleteAction(Request $request, $id)
    {
        $language = $this->getLanguage($request);
        $webspace = $this->getWebspace($request);
        $force = $this->getBooleanRequestParameter($request, 'force', false, false);

        if (!$force) {
            $references = array_filter(
                $this->getRepository()->getReferences($id),
                function(PropertyInterface $reference) {
                    return $reference->getParent()->isNodeType('sulu:page');
                }
            );

            if (count($references) > 0) {
                $data = [
                    'structures' => [],
                    'other' => [],
                ];

                foreach ($references as $reference) {
                    $content = $this->get('sulu.content.mapper')->load(
                        $reference->getParent()->getIdentifier(),
                        $webspace,
                        $language,
                        true
                    );
                    $data['structures'][] = $content->toArray();
                }

                return $this->handleView($this->view($data, 409));
            }
        }

        $view = $this->responseDelete(
            $id,
            function($id) use ($webspace) {
                try {
                    $this->getRepository()->deleteNode($id, $webspace);
                } catch (DocumentNotFoundException $ex) {
                    throw new EntityNotFoundException('Content', $id);
                }
            }
        );

        return $this->handleView($view);
    }
149233
function ezWhatPageNumber( $pageNum, $identifier = false )
    {
        if ( $identifier === false )
        {
            foreach ( array_keys( $this->PageCounter ) as $identifier )
            {
                if ( isset( $this->PageCounter[$identifier]['start'] ) &&
                     $this->PageCounter[$identifier]['start'] <= $pageNum &&
                     ( !isset( $this->PageCounter[$identifier]['stop'] ) || $this->PageCounter[$identifier]['stop'] >= $pageNum ) )
                    return $pageNum - $this->PageCounter[$identifier]['start'] + 1;
            }
        }
        else
            return $pageNum - $this->PageCounter[$identifier]['start'] + 1;
    }
1114693
public function fetch(RequestDescriptor $request, $flags = 0)
    {
        $response = $this->send($request, $flags);
        $class    = $response->getMeta('entity');

        $data   = $response->getData();
        $entity = array();

        if (!empty($class)) {
            if (isset($data[0]) && is_array($data[0])) {
                foreach ($data as $resource) {
                    /** @var EntityInterface $entity */
                    $subEntity = new $class;
                    $entity->hydrate($resource);
                    $entity[] = $subEntity;
                }
            } else {

                /** @var EntityInterface $entity */
                $entity = new $class;
                $entity->hydrate($response->getData());
            }
        }

        return $entity;
    }
961722
public function loadSectionDataByIdentifier($identifier)
    {
        try {
            return $this->innerGateway->loadSectionDataByIdentifier($identifier);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
647988
public function show($id, Request $request)
    {
        $entity = $this->getEntityById($id);

        if (!$entity) {
            return $this->response(null, Response::HTTP_NOT_FOUND);
        }

        return $this->response($this->serialize($entity, $request), Response::HTTP_OK);
    }
1303983
public function cgetAction($categoryId, Request $request)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        /** @var DoctrineListBuilderFactory $factory */
        $factory = $this->get('sulu_core.doctrine_list_builder_factory');

        /** @var CategoryInterface $category */
        $category = $this->getCategoryRepository()->find($categoryId);

        $fieldDescriptor = $this->getFieldDescriptors();

        $listBuilder = $factory->create($this->getParameter('sulu.model.keyword.class'));
        $restHelper->initializeListBuilder($listBuilder, $fieldDescriptor);

        $listBuilder->where($fieldDescriptor['locale'], $request->get('locale'));
        $listBuilder->where(
            $fieldDescriptor['categoryTranslationIds'],
            $category->findTranslationByLocale($request->get('locale'))
        );

        // should eliminate duplicates
        $listBuilder->distinct(true);
        $listBuilder->addGroupBy($fieldDescriptor['id']);

        $listResponse = $listBuilder->execute();

        $list = new ListRepresentation(
            $listResponse,
            self::$entityKey,
            'get_category_keywords',
            array_merge(['categoryId' => $categoryId], $request->query->all()),
            $listBuilder->getCurrentPage(),
            $listBuilder->getLimit(),
            $listBuilder->count()
        );

        return $this->handleView($this->view($list, 200));
    }
739642
public function process($identifier, \SS_HTTPRequest $request)
    {
        if ($this->hasProcessor($identifier)) {
            return $this->processors[$identifier]->process($request);
        } else {
            return false;
        }
    }
1136992
private function getRequestedPage(Request $request)
    {
        $pageNumber = $request->query->getInt('page', 1);
        if (!$pageNumber || $pageNumber < 1) {
            $pageNumber = 1;
        }

        return $pageNumber;
    }
989759
public function cgetAction(Request $request)
    {
        $locale = $this->getLocale($request);

        // if the type parameter is falsy, assign NULL to $type
        $type = $request->query->get('type', null) ?: null;

        $idsString = $request->get('ids');

        if ($idsString) {
            $ids = explode(',', $idsString);
            $snippets = $this->snippetRepository->getSnippetsByUuids($ids, $locale);
            $total = count($snippets);
        } else {
            $snippets = $this->snippetRepository->getSnippets(
                $locale,
                $type,
                $this->listRestHelper->getOffset(),
                $this->listRestHelper->getLimit(),
                $this->listRestHelper->getSearchPattern(),
                $this->listRestHelper->getSortColumn(),
                $this->listRestHelper->getSortOrder()
            );

            $total = $this->snippetRepository->getSnippetsAmount(
                $locale,
                $type,
                $this->listRestHelper->getSearchPattern(),
                $this->listRestHelper->getSortColumn(),
                $this->listRestHelper->getSortOrder()
            );
        }

        $data = new ListRepresentation(
            $snippets,
            'snippets',
            'get_snippets',
            $request->query->all(),
            $this->listRestHelper->getPage(),
            $this->listRestHelper->getLimit(),
            $total
        );

        return $this->viewHandler->handle(View::create($data));
    }
628254
public function showAction(Request $request, $id, $parameterBag)
    {
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('AmulenPageBundle:Page')->find($id);
        $entity->setViewCount($entity->getViewCount() + 1);
        $em->flush();

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $locale = $request->getLocale();
        $seoPage = $this->container->get('sonata.seo.page');

        /* title */
        $title = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "title", "lang" => $locale));
        if ($title) {
            $pageTitle = $title->getContent() . " - " . $seoPage->getTitle();
        } else {
            $pageTitle = $entity->getName() . " - " . $seoPage->getTitle();
        }
        $seoPage
            ->setTitle($pageTitle);

        /* description */
        $description = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "description", "lang" => $locale));
        if ($description) {
            $pageDescription = $description->getContent();
        } else {
            $pageDescription = $entity->getDescription();
        }
        /* locale */
        $localeOg = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "locale", "lang" => $locale));
        if ($localeOg) {
            $pagelocale = $localeOg->getContent();
            $seoPage->addMeta('locale', 'og:locale', $pagelocale);
        } else {
            $seoPage->addMeta('locale', 'og:locale', $locale);
        }
        /* type */
        $type = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "type", "lang" => $locale));
        if ($type) {
            $pagelocale = $type->getContent();
            $seoPage->addMeta('type', 'og:type', $pagelocale);
        }
        /* type */
        $site_name = $em->getRepository('AmulenPageBundle:Block')->findOneBy(array('page' => $id, 'name' => "site_name", "lang" => $locale));
        if ($site_name) {
            $pagelocale = $site_name->getContent();
            $seoPage->addMeta('site_name', 'og:site_name', $pagelocale);
        }

        if (!is_null($entity->getImage()) && $entity->getImage() != "") {
            $siteUrl = $this->get("amulen.dashboard.service.setting")->getValue(Setting::SITE_URL);
            $seoPage->addMeta('property', 'og:image', str_replace(" ", "%20", $siteUrl . "/" . $entity->getImage()));
            $seoPage->addMeta('property', 'twitter:image', str_replace(" ", "%20", $siteUrl . "/" . $entity->getImage()));
        }
        $seoPage->addMeta('property', 'twitter:title', $pageTitle);
        $seoPage->addMeta('property', 'twitter:description', $pageDescription);

        $seoPage
            ->addMeta('name', 'description', $pageDescription)
            ->addMeta('property', 'og:title', $pageTitle)
            ->addMeta('property', 'og:description', $pageDescription);
        return $this->render($entity->getTemplate(), array('page' => $entity, 'parameterBag' => $parameterBag));
    }