@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | private $facetFormatter; |
| 33 | 33 | |
| 34 | 34 | public function searchAction(Request $request, DocumentToEntityMapperInterface $mapper) { |
| 35 | - if($request->query->get('term', false) !== false) { |
|
| 35 | + if ($request->query->get('term', false) !== false) { |
|
| 36 | 36 | $this->setSearchTerm($request->getSession(), $request->query->get('term')); |
| 37 | 37 | $this->removeFilterOptions($request->getSession()); |
| 38 | 38 | return $this->redirectToRoute('stinger_soft_entity_search_search'); |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | )); |
| 50 | 50 | |
| 51 | 51 | $facetForm->handleRequest($request); |
| 52 | - if($facetForm->isSubmitted()) { |
|
| 53 | - if($facetForm->get('clear')->isClicked()) { |
|
| 52 | + if ($facetForm->isSubmitted()) { |
|
| 53 | + if ($facetForm->get('clear')->isClicked()) { |
|
| 54 | 54 | $query->setFacets($this->getDefaultFacets()); |
| 55 | 55 | } |
| 56 | 56 | $this->setSearchTerm($request->getSession(), $query->getSearchTerm()); |
| 57 | 57 | $this->setSearchFacets($request->getSession(), $query->getFacets()); |
| 58 | - } elseif($this->getUnsetFilterOptions($request->getSession())) { |
|
| 58 | + } elseif ($this->getUnsetFilterOptions($request->getSession())) { |
|
| 59 | 59 | $query->setFacets($this->getDefaultFacets()); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $page = (int)$request->query->get('page', 1); |
| 72 | 72 | $results = null; |
| 73 | - if($result instanceof PaginatableResultSet) { |
|
| 73 | + if ($result instanceof PaginatableResultSet) { |
|
| 74 | 74 | $results = $result->paginate($page, $this->getResultsPerPage()); |
| 75 | - } elseif($result !== null) { |
|
| 75 | + } elseif ($result !== null) { |
|
| 76 | 76 | $results = $result->getResults(($page - 1) * $this->getResultsPerPage(), $this->getResultsPerPage()); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | 'mapper' => $mapper, |
| 84 | 84 | 'facetForm' => $facetForm->createView() |
| 85 | 85 | )); |
| 86 | - } catch(\Exception $exception) { |
|
| 86 | + } catch (\Exception $exception) { |
|
| 87 | 87 | $response = $this->render($this->getErrorTemplate(), array( |
| 88 | 88 | 'error' => $exception->getMessage(), |
| 89 | 89 | 'term' => $query->getSearchTerm() |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | protected function getConfiguredUsedFacets(array $queryUsedFacets) { |
| 128 | 128 | $availableFacets = $this->getAvailableFacets(); |
| 129 | 129 | $usedFacets = array(); |
| 130 | - foreach($queryUsedFacets as $queryUsedFacet) { |
|
| 130 | + foreach ($queryUsedFacets as $queryUsedFacet) { |
|
| 131 | 131 | $usedFacets[$queryUsedFacet] = $availableFacets[$queryUsedFacet]; |
| 132 | 132 | } |
| 133 | 133 | return $usedFacets; |
@@ -194,15 +194,15 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | protected function initFacets() { |
| 197 | - if(!$this->availableFacets) { |
|
| 197 | + if (!$this->availableFacets) { |
|
| 198 | 198 | $this->availableFacets = array(); |
| 199 | 199 | $this->facetFormatter = array(); |
| 200 | 200 | |
| 201 | 201 | $facetServices = $this->getParameter('stinger_soft.entity_search.available_facets'); |
| 202 | - foreach($facetServices as $facetServiceId) { |
|
| 202 | + foreach ($facetServices as $facetServiceId) { |
|
| 203 | 203 | $facetService = $this->searchService->getFacet($facetServiceId); |
| 204 | 204 | $this->availableFacets[$facetService->getField()] = $facetService->getFormOptions(); |
| 205 | - if($facetService->getFacetFormatter()) { |
|
| 205 | + if ($facetService->getFacetFormatter()) { |
|
| 206 | 206 | $this->facetFormatter[$facetService->getField()] = $facetService->getFacetFormatter(); |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -216,16 +216,16 @@ discard block |
||
| 216 | 216 | * @return string[string][] |
| 217 | 217 | */ |
| 218 | 218 | protected function getSearchFacets(SessionInterface $session) { |
| 219 | - $facets = $session->get($this->getSessionPrefix() . '_facets', false); |
|
| 219 | + $facets = $session->get($this->getSessionPrefix().'_facets', false); |
|
| 220 | 220 | return $facets ? \json_decode($facets, true) : $this->getDefaultFacets(); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | protected function removeFilterOptions(SessionInterface $session) { |
| 224 | - $session->remove($this->getSessionPrefix() . '_filter_options'); |
|
| 224 | + $session->remove($this->getSessionPrefix().'_filter_options'); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | protected function getUnsetFilterOptions(SessionInterface $session) { |
| 228 | - return $session->get($this->getSessionPrefix() . '_filter_options', true); |
|
| 228 | + return $session->get($this->getSessionPrefix().'_filter_options', true); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | * @param string[string][] $facets |
| 236 | 236 | */ |
| 237 | 237 | protected function setSearchFacets(SessionInterface $session, $facets) { |
| 238 | - $session->set($this->getSessionPrefix() . '_facets', \json_encode($facets)); |
|
| 239 | - $session->set($this->getSessionPrefix() . '_filter_options', false); |
|
| 238 | + $session->set($this->getSessionPrefix().'_facets', \json_encode($facets)); |
|
| 239 | + $session->set($this->getSessionPrefix().'_filter_options', false); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @return mixed |
| 247 | 247 | */ |
| 248 | 248 | protected function getSearchTerm(SessionInterface $session) { |
| 249 | - return $session->get($this->getSessionPrefix() . '_term', false); |
|
| 249 | + return $session->get($this->getSessionPrefix().'_term', false); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @param string $term |
| 257 | 257 | */ |
| 258 | 258 | protected function setSearchTerm(SessionInterface $session, $term) { |
| 259 | - $session->set($this->getSessionPrefix() . '_term', $term); |
|
| 259 | + $session->set($this->getSessionPrefix().'_term', $term); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | \ No newline at end of file |