From f5c7c7fafb18db91b3f6698fb5aa765c59a8b7cf Mon Sep 17 00:00:00 2001 From: Damien Pobel Date: Thu, 29 Oct 2015 12:49:15 +0100 Subject: [PATCH] Added the typeIdentifier parameter in the server side controller --- Controller/ListController.php | 9 +++++++-- Resources/config/routing.yml | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Controller/ListController.php b/Controller/ListController.php index 5b5f498..4554272 100644 --- a/Controller/ListController.php +++ b/Controller/ListController.php @@ -16,11 +16,15 @@ public function __construct(SearchService $searchService) $this->searchService = $searchService; } - public function listAction($offset) + public function listAction($offset, $typeIdentifier) { $limit = 10; $query = new LocationQuery(); - $query->query = new Criterion\Subtree('/1/'); + if ( $typeIdentifier ) { + $query->query = new Criterion\ContentTypeIdentifier($typeIdentifier); + } else { + $query->query = new Criterion\Subtree('/1/'); + } $query->offset = (int)$offset; $query->limit = $limit; $results = $this->searchService->findLocations($query); @@ -34,6 +38,7 @@ public function listAction($offset) $next = $offset + $limit; } return $this->render('EzSystemsExtendingPlatformUIConferenceBundle:List:list.html.twig', [ + 'typeIdentifier' => $typeIdentifier, 'results' => $results, 'previous' => $previous, 'next' => $next, diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index de33b73..a8873a0 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -3,7 +3,8 @@ ez_systems_extending_platform_ui_conference_homepage: defaults: { _controller: EzSystemsExtendingPlatformUIConferenceBundle:Default:index } list: - path: /list/{offset} - defaults: { _controller: ezsystems.extendingplatformuiconference.controller.list:listAction, offset: 0 } + path: /list/{offset}/{typeIdentifier} + defaults: { _controller: ezsystems.extendingplatformuiconference.controller.list:listAction, offset: 0, typeIdentifier: "" } requirements: offset: \d+ + typeIdentifier: "[a-zA-Z_]+"