ServiceRouterLoader.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Routing\Loader\DependencyInjection;
  11. use Psr\Container\ContainerInterface;
  12. use Symfony\Component\Routing\Loader\ContainerLoader;
  13. use Symfony\Component\Routing\Loader\ObjectRouteLoader;
  14. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ServiceRouterLoader::class, ContainerLoader::class), E_USER_DEPRECATED);
  15. /**
  16. * A route loader that executes a service to load the routes.
  17. *
  18. * @author Ryan Weaver <ryan@knpuniversity.com>
  19. *
  20. * @deprecated since Symfony 4.4, use Symfony\Component\Routing\Loader\ContainerLoader instead.
  21. */
  22. class ServiceRouterLoader extends ObjectRouteLoader
  23. {
  24. /**
  25. * @var ContainerInterface
  26. */
  27. private $container;
  28. public function __construct(ContainerInterface $container)
  29. {
  30. $this->container = $container;
  31. }
  32. protected function getServiceObject($id)
  33. {
  34. return $this->container->get($id);
  35. }
  36. }