|
@@ -1,65 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-namespace Symfony\Bundle\FrameworkBundle\Routing;
|
|
|
-
|
|
|
-use Symfony\Component\Routing\Loader\LoaderResolver as BaseLoaderResolver;
|
|
|
-use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
-use Symfony\Component\Routing\Loader\LoaderInterface;
|
|
|
-
|
|
|
-/*
|
|
|
- * This file is part of the Symfony package.
|
|
|
- *
|
|
|
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
- *
|
|
|
- * For the full copyright and license information, please view the LICENSE
|
|
|
- * file that was distributed with this source code.
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * This loader resolver automatically registers routing loaders from
|
|
|
- * the container.
|
|
|
- *
|
|
|
- * If also lazy-loads them.
|
|
|
- *
|
|
|
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
- */
|
|
|
-class LoaderResolver extends BaseLoaderResolver
|
|
|
-{
|
|
|
- protected $services;
|
|
|
- protected $container;
|
|
|
-
|
|
|
- /**
|
|
|
- * Constructor.
|
|
|
- *
|
|
|
- * @param ContainerInterface $container A ContainerInterface instance
|
|
|
- * @param array $loaders An array of LoaderInterface instances to add
|
|
|
- */
|
|
|
- public function __construct(ContainerInterface $container, array $loaders = array())
|
|
|
- {
|
|
|
- parent::__construct($loaders);
|
|
|
-
|
|
|
- $this->container = $container;
|
|
|
- foreach ($container->findTaggedServiceIds('routing.loader') as $id => $attributes) {
|
|
|
- $this->services[] = $id;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns a loader able to load the resource.
|
|
|
- *
|
|
|
- * @param mixed $resource A resource
|
|
|
- * @param string $type The resource type
|
|
|
- *
|
|
|
- * @return LoaderInterface A LoaderInterface instance
|
|
|
- */
|
|
|
- public function resolve($resource, $type = null)
|
|
|
- {
|
|
|
- if (count($this->services)) {
|
|
|
- while ($id = array_shift($this->services)) {
|
|
|
- $this->addLoader($this->container->get($id));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return parent::resolve($resource, $type);
|
|
|
- }
|
|
|
-}
|