1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the ONGR package. |
5
|
|
|
* |
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace ONGR\TranslationsBundle\Controller; |
13
|
|
|
|
14
|
|
|
use ONGR\FilterManagerBundle\Search\SearchResponse; |
15
|
|
|
use ONGR\TranslationsBundle\Service\TranslationManager; |
16
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
17
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
18
|
|
|
use Symfony\Component\HttpFoundation\Request; |
19
|
|
|
use Symfony\Component\HttpFoundation\Response; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Controller used for displaying translations. |
23
|
|
|
*/ |
24
|
|
|
class ListController extends Controller |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @param Request $request |
28
|
|
|
* @return JsonResponse |
29
|
|
|
*/ |
30
|
|
|
public function listAction(Request $request) |
31
|
|
|
{ |
32
|
|
|
/** @var SearchResponse $filterResponse */ |
33
|
|
|
$filterResponse = $this->get('ongr_translations.filter_manager')->handleRequest($request); |
34
|
|
|
|
35
|
|
|
return new JsonResponse(iterator_to_array($filterResponse->getResult())); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Renders view with filter manager response. |
40
|
|
|
* |
41
|
|
|
* @param Request $request Request. |
42
|
|
|
* |
43
|
|
|
* @return Response |
44
|
|
|
*/ |
45
|
|
|
public function indexAction(Request $request) |
|
|
|
|
46
|
|
|
{ |
47
|
|
|
/** @var TranslationManager $manager */ |
48
|
|
|
$manager = $this->get('ongr_translations.translation_manager'); |
49
|
|
|
|
50
|
|
|
return $this->render( |
51
|
|
|
'ONGRTranslationsBundle:List:list.html.twig', |
52
|
|
|
[ |
53
|
|
|
'locales' => $this->getParameter('ongr_translations.locales'), |
54
|
|
|
'tags' => $manager->getTags(), |
55
|
|
|
'domains' => $manager->getDomains(), |
56
|
|
|
] |
57
|
|
|
); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.