vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Controller/LocalizationController.php line 27

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\CoreBundle\Controller;
  11. use FOS\RestBundle\View\ViewHandlerInterface;
  12. use HandcraftedInTheAlps\RestRoutingBundle\Routing\ClassResourceInterface;
  13. use Sulu\Bundle\AdminBundle\Controller\AdminController;
  14. use Sulu\Component\Localization\Manager\LocalizationManagerInterface;
  15. use Sulu\Component\Rest\AbstractRestController;
  16. use Sulu\Component\Rest\ListBuilder\CollectionRepresentation;
  17. use Symfony\Component\HttpFoundation\Response;
  18. @trigger_deprecation(
  19.     'sulu/sulu',
  20.     '2.0',
  21.     'The "%s" class is deprecated since, use data from "%s" instead.',
  22.     LocalizationController::class,
  23.     AdminController::class
  24. );
  25. /**
  26.  * @deprecated Deprecated since Sulu 2.0, use data from Sulu\Bundle\AdminBundle\Controller\AdminController::configAction
  27.  * Remember deleting the resource configuration from Sulu\Bundle\AdminBundle\DependencyInjection\SuluAdminExtension.
  28.  */
  29. class LocalizationController extends AbstractRestController implements ClassResourceInterface
  30. {
  31.     /**
  32.      * @var LocalizationManagerInterface
  33.      */
  34.     private $localizationManager;
  35.     public function __construct(
  36.         ViewHandlerInterface $viewHandler,
  37.         LocalizationManagerInterface $localizationManager
  38.     ) {
  39.         parent::__construct($viewHandler);
  40.         $this->localizationManager $localizationManager;
  41.     }
  42.     /**
  43.      * Returns all the localizations available in this system.
  44.      *
  45.      * @return Response
  46.      */
  47.     public function cgetAction()
  48.     {
  49.         $representation = new CollectionRepresentation(
  50.             \array_values($this->localizationManager->getLocalizations()),
  51.             'localizations'
  52.         );
  53.         return $this->handleView(
  54.             $this->view($representation200)
  55.         );
  56.     }
  57. }