Skip to content

Instantly share code, notes, and snippets.

@rande
Created January 21, 2011 10:02
Show Gist options
  • Save rande/789494 to your computer and use it in GitHub Desktop.
Save rande/789494 to your computer and use it in GitHub Desktop.
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index ed7dbb9..d61509d 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -295,25 +295,21 @@ abstract class Kernel implements HttpKernelInterface, \Serializable
$isResource = 0 === strpos($path, 'Resources');
- // return the first matching one
- if (true === $first) {
- if (true === $isResource && null !== $dir && is_file($file = $dir.'/'.$bundle.'/'.substr($path, 10))) {
- return $file;
- } elseif (is_file($file = $this->getBundle($bundle)->getPath().'/'.$path)) {
- return $file;
- }
-
- throw new \InvalidArgumentException(sprintf('Unable to find file "@%s".', $name));
- }
-
// return them all
$files = array();
if (true === $isResource && null !== $dir && is_file($file = $dir.'/'.$bundle.'/'.substr($path, 10))) {
+ if($first) {
+ return $file;
+ }
+
$files[] = $file;
}
foreach ($this->getBundle($bundle, false) as $bundle) {
if (is_file($file = $bundle->getPath().'/'.$path)) {
+ if($first) {
+ return $file;
+ }
$files[] = $file;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment