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

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_error(
  19.     \sprintf(
  20.         'The "%s" class is deprecated since Sulu 2.0, use data from "%s" instead.',
  21.         LocalizationController::class,
  22.         AdminController::class
  23.     ),
  24.     \E_USER_DEPRECATED
  25. );
  26. /**
  27.  * @deprecated Deprecated since Sulu 2.0, use data from Sulu\Bundle\AdminBundle\Controller\AdminController::configAction
  28.  * Remember deleting the resource configuration from Sulu\Bundle\AdminBundle\DependencyInjection\SuluAdminExtension.
  29.  */
  30. class LocalizationController extends AbstractRestController implements ClassResourceInterface
  31. {
  32.     /**
  33.      * @var LocalizationManagerInterface
  34.      */
  35.     private $localizationManager;
  36.     public function __construct(
  37.         ViewHandlerInterface $viewHandler,
  38.         LocalizationManagerInterface $localizationManager
  39.     ) {
  40.         parent::__construct($viewHandler);
  41.         $this->localizationManager $localizationManager;
  42.     }
  43.     /**
  44.      * Returns all the localizations available in this system.
  45.      *
  46.      * @return Response
  47.      */
  48.     public function cgetAction()
  49.     {
  50.         $representation = new CollectionRepresentation(
  51.             \array_values($this->localizationManager->getLocalizations()),
  52.             'localizations'
  53.         );
  54.         return $this->handleView(
  55.             $this->view($representation200)
  56.         );
  57.     }
  58. }