bug #17672 [DependencyInjection][Routing] add files used in FileResource objects (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection][Routing] add files used in FileResource objects

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/17598#discussion_r51756307
| License       | MIT
| Doc PR        |

Starting with Symfony 3.1, the constructor of the `FileResource` class
will throw an exception when the passed file does not exist.

Commits
-------

4f865c7 add files used in FileResource objects
This commit is contained in:
Nicolas Grekas 2016-02-04 14:49:46 +01:00
commit 876bad9730
2 changed files with 3 additions and 1 deletions

View File

@ -243,7 +243,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
do {
$this->addResource(new FileResource($class->getFileName()));
if (is_file($class->getFileName())) {
$this->addResource(new FileResource($class->getFileName()));
}
} while ($class = $class->getParentClass());
return $this;