2727use Symfony \Component \HttpFoundation \RedirectResponse ;
2828use Symfony \Component \HttpFoundation \Request ;
2929use Symfony \Component \HttpFoundation \Response ;
30- use Symfony \ Component \ Templating \ EngineInterface ;
30+ use Twig \ Environment ;
3131
3232class SearchController extends AbstractController
3333{
3434 public const SORT_ASC = 'asc ' ;
3535 public const SORT_DESC = 'desc ' ;
3636
37- /** @var EngineInterface */
37+ /** @var Environment */
3838 private $ templatingEngine ;
3939
4040 /** @var Search */
@@ -55,19 +55,8 @@ class SearchController extends AbstractController
5555 /** @var RenderDocumentUrlHelper */
5656 private $ renderDocumentUrlHelper ;
5757
58- /**
59- * SearchController constructor.
60- *
61- * @param EngineInterface $templatingEngine
62- * @param Search $documentSearch
63- * @param ChannelContextInterface $channelContext
64- * @param CurrencyContextInterface $currencyContext
65- * @param TaxonContextInterface $taxonContext
66- * @param GridConfig $gridConfig
67- * @param RenderDocumentUrlHelper $renderDocumentUrlHelper
68- */
6958 public function __construct (
70- EngineInterface $ templatingEngine ,
59+ Environment $ templatingEngine ,
7160 Search $ documentSearch ,
7261 ChannelContextInterface $ channelContext ,
7362 CurrencyContextInterface $ currencyContext ,
@@ -138,15 +127,15 @@ public function searchAction(Request $request): Response
138127 $ formatter = new \NumberFormatter ($ request ->getLocale () . '@currency= ' . $ currencyCode , \NumberFormatter::CURRENCY );
139128
140129 // Display result list
141- return $ this ->templatingEngine ->renderResponse ('@MonsieurBizSyliusSearchPlugin/Search/result.html.twig ' , [
130+ return new Response ( $ this ->templatingEngine ->render ('@MonsieurBizSyliusSearchPlugin/Search/result.html.twig ' , [
142131 'query ' => $ this ->gridConfig ->getQuery (),
143132 'limits ' => $ this ->gridConfig ->getLimits (),
144133 'resultSet ' => $ resultSet ,
145134 'channel ' => $ this ->channelContext ->getChannel (),
146135 'currencyCode ' => $ this ->currencyContext ->getCurrencyCode (),
147136 'moneySymbol ' => $ formatter ->getSymbol (\NumberFormatter::CURRENCY_SYMBOL ),
148137 'gridConfig ' => $ this ->gridConfig ,
149- ]);
138+ ])) ;
150139 }
151140
152141 /**
@@ -166,13 +155,13 @@ public function instantAction(Request $request): Response
166155 $ resultSet = $ this ->documentSearch ->instant ($ this ->gridConfig );
167156
168157 // Display instant result list
169- return $ this ->templatingEngine ->renderResponse ('@MonsieurBizSyliusSearchPlugin/Instant/result.html.twig ' , [
158+ return new Response ( $ this ->templatingEngine ->render ('@MonsieurBizSyliusSearchPlugin/Instant/result.html.twig ' , [
170159 'query ' => $ this ->gridConfig ->getQuery (),
171160 'resultSet ' => $ resultSet ,
172161 'channel ' => $ this ->channelContext ->getChannel (),
173162 'currencyCode ' => $ this ->currencyContext ->getCurrencyCode (),
174163 'gridConfig ' => $ this ->gridConfig ,
175- ]);
164+ ])) ;
176165 }
177166
178167 /**
@@ -196,14 +185,14 @@ public function taxonAction(Request $request): Response
196185 $ formatter = new \NumberFormatter ($ request ->getLocale () . '@currency= ' . $ currencyCode , \NumberFormatter::CURRENCY );
197186
198187 // Display result list
199- return $ this ->templatingEngine ->renderResponse ('@MonsieurBizSyliusSearchPlugin/Taxon/result.html.twig ' , [
188+ return new Response ( $ this ->templatingEngine ->render ('@MonsieurBizSyliusSearchPlugin/Taxon/result.html.twig ' , [
200189 'taxon ' => $ this ->gridConfig ->getTaxon (),
201190 'limits ' => $ this ->gridConfig ->getLimits (),
202191 'resultSet ' => $ resultSet ,
203192 'channel ' => $ this ->channelContext ->getChannel (),
204193 'currencyCode ' => $ this ->currencyContext ->getCurrencyCode (),
205194 'moneySymbol ' => $ formatter ->getSymbol (\NumberFormatter::CURRENCY_SYMBOL ),
206195 'gridConfig ' => $ this ->gridConfig ,
207- ]);
196+ ])) ;
208197 }
209198}
0 commit comments