@@ -9,7 +9,6 @@ |
||
9 | 9 | namespace StingerSoft\EntitySearchBundle\Controller; |
10 | 10 | |
11 | 11 | use StingerSoft\EntitySearchBundle\Form\QueryType; |
12 | -use StingerSoft\EntitySearchBundle\Model\Document; |
|
13 | 12 | use StingerSoft\EntitySearchBundle\Model\PaginatableResultSet; |
14 | 13 | use StingerSoft\EntitySearchBundle\Model\Query; |
15 | 14 | use StingerSoft\EntitySearchBundle\Services\Facet\FacetServiceInterface; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | public function searchAction(Request $request) { |
40 | - if($request->query->get('term', false) !== false) { |
|
40 | + if ($request->query->get('term', false) !== false) { |
|
41 | 41 | $this->setSearchTerm($request->getSession(), $request->query->get('term')); |
42 | 42 | return $this->redirectToRoute('stinger_soft_entity_search_search'); |
43 | 43 | } |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | )); |
54 | 54 | |
55 | 55 | $facetForm->handleRequest($request); |
56 | - if($facetForm->isSubmitted()) { |
|
57 | - if($facetForm->get('clear')->isClicked()) { |
|
56 | + if ($facetForm->isSubmitted()) { |
|
57 | + if ($facetForm->get('clear')->isClicked()) { |
|
58 | 58 | $query->setFacets($this->getDefaultFacets()); |
59 | 59 | } |
60 | 60 | $this->setSearchTerm($request->getSession(), $query->getSearchTerm()); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $page = $request->query->get('page', 1); |
72 | 72 | $results = array(); |
73 | - if($result instanceof PaginatableResultSet) { |
|
73 | + if ($result instanceof PaginatableResultSet) { |
|
74 | 74 | $results = $result->paginate($page, $this->getResultsPerPage()); |
75 | 75 | } else { |
76 | 76 | $results = $result->getResults(($page - 1) * $this->getResultsPerPage(), $this->getResultsPerPage()); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | protected function getConfiguredUsedFacets(array $queryUsedFacets) { |
89 | 89 | $availableFacets = $this->getAvailableFacets(); |
90 | 90 | $usedFacets = array(); |
91 | - foreach($queryUsedFacets as $queryUsedFacet) { |
|
91 | + foreach ($queryUsedFacets as $queryUsedFacet) { |
|
92 | 92 | $usedFacets[$queryUsedFacet] = $availableFacets[$queryUsedFacet]; |
93 | 93 | } |
94 | 94 | return $usedFacets; |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | protected function initFacets() { |
155 | - if(!$this->availableFacets) { |
|
155 | + if (!$this->availableFacets) { |
|
156 | 156 | $this->availableFacets = array(); |
157 | 157 | $this->facetFormatter = array(); |
158 | 158 | |
159 | 159 | $facetServices = $this->getParameter('stinger_soft.entity_search.available_facets'); |
160 | - foreach($facetServices as $facetServiceId) { |
|
160 | + foreach ($facetServices as $facetServiceId) { |
|
161 | 161 | /** @var FacetServiceInterface $facetService */ |
162 | 162 | $facetService = $this->get($facetServiceId); |
163 | 163 | $this->availableFacets[$facetService->getField()] = $facetService->getFormOptions(); |
164 | - if($facetService->getFacetFormatter()) { |
|
164 | + if ($facetService->getFacetFormatter()) { |
|
165 | 165 | $this->facetFormatter[$facetService->getField()] = $facetService->getFacetFormatter(); |
166 | 166 | } |
167 | 167 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @return string[string][] |
176 | 176 | */ |
177 | 177 | protected function getSearchFacets(SessionInterface $session) { |
178 | - $facets = $session->get($this->getSessionPrefix() . '_facets', false); |
|
178 | + $facets = $session->get($this->getSessionPrefix().'_facets', false); |
|
179 | 179 | return $facets ? json_decode($facets, true) : $this->getDefaultFacets(); |
180 | 180 | } |
181 | 181 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param string[string][] $facets |
187 | 187 | */ |
188 | 188 | protected function setSearchFacets(SessionInterface $session, $facets) { |
189 | - $session->set($this->getSessionPrefix() . '_facets', json_encode($facets)); |
|
189 | + $session->set($this->getSessionPrefix().'_facets', json_encode($facets)); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @return mixed |
197 | 197 | */ |
198 | 198 | protected function getSearchTerm(SessionInterface $session) { |
199 | - return $session->get($this->getSessionPrefix() . '_term', false); |
|
199 | + return $session->get($this->getSessionPrefix().'_term', false); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param string $term |
207 | 207 | */ |
208 | 208 | protected function setSearchTerm(SessionInterface $session, $term) { |
209 | - $session->set($this->getSessionPrefix() . '_term', $term); |
|
209 | + $session->set($this->getSessionPrefix().'_term', $term); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |