Skip to content

Commit

Permalink
Amend route default to match attributed methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBehrens committed Jun 5, 2020
1 parent d8c7d94 commit feef453
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Storefront/Controller/CmsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,14 @@ public function __construct(
* Route for cms data (used in XmlHttpRequest)
*
* @HttpCache()
* @Route("/widgets/cms/{id}", name="frontend.cms.page", methods={"GET", "POST"}, defaults={"id"=null, "XmlHttpRequest"=true})
* @Route("/widgets/cms/{id}", name="frontend.cms.page", methods={"GET", "POST"}, defaults={"XmlHttpRequest"=true})
*
* @throws InconsistentCriteriaIdsException
* @throws MissingRequestParameterException
* @throws PageNotFoundException
*/
public function page(string $id, Request $request, SalesChannelContext $salesChannelContext): Response
{
if (!$id) {
throw new MissingRequestParameterException('Parameter id missing');
}

$cmsPage = $this->cmsRoute->load($id, $request, $salesChannelContext)->getCmsPage();

return $this->renderStorefront('@Storefront/storefront/page/content/detail.html.twig', ['cmsPage' => $cmsPage]);
Expand All @@ -72,7 +68,7 @@ public function page(string $id, Request $request, SalesChannelContext $salesCha
* Route to load a cms page which assigned to the provided navigation id.
* Navigation id is required to load the slot config for the navigation
*
* @Route("/widgets/cms/navigation/{navigationId}", name="frontend.cms.navigation.page", methods={"GET", "POST"}, defaults={"navigationId"=null, "XmlHttpRequest"=true})
* @Route("/widgets/cms/navigation/{navigationId}", name="frontend.cms.navigation.page", methods={"GET", "POST"}, defaults={"XmlHttpRequest"=true})
*
* @throws CategoryNotFoundException
* @throws MissingRequestParameterException
Expand All @@ -81,10 +77,6 @@ public function page(string $id, Request $request, SalesChannelContext $salesCha
*/
public function category(string $navigationId, Request $request, SalesChannelContext $salesChannelContext): Response
{
if (!$navigationId) {
throw new MissingRequestParameterException('Parameter navigationId missing');
}

$category = $this->categoryRoute->load($navigationId, $request, $salesChannelContext)->getCategory();

if (!$category->getCmsPageId()) {
Expand Down

0 comments on commit feef453

Please sign in to comment.