ServiceRouterLoader.php 862 B

1234567891011121314151617181920212223242526272829303132333435363738
  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\ObjectRouteLoader;
  13. /**
  14. * A route loader that executes a service to load the routes.
  15. *
  16. * @author Ryan Weaver <ryan@knpuniversity.com>
  17. */
  18. class ServiceRouterLoader extends ObjectRouteLoader
  19. {
  20. /**
  21. * @var ContainerInterface
  22. */
  23. private $container;
  24. public function __construct(ContainerInterface $container)
  25. {
  26. $this->container = $container;
  27. }
  28. protected function getServiceObject($id)
  29. {
  30. return $this->container->get($id);
  31. }
  32. }