Skip to content

Commit

Permalink
Added the typeIdentifier parameter in the server side controller
Browse files Browse the repository at this point in the history
  • Loading branch information
dpobel committed Oct 30, 2015
1 parent 6b54490 commit f5c7c7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Controller/ListController.php
Expand Up @@ -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);
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions Resources/config/routing.yml
Expand Up @@ -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_]+"

0 comments on commit f5c7c7f

Please sign in to comment.