소스 검색

Merge remote branch 'kriswallsmith/assetic/controller-fix'

* kriswallsmith/assetic/controller-fix:
  [AsseticBundle] fixed controller
Fabien Potencier 14 년 전
부모
커밋
2c939e4124
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      src/Symfony/Bundle/AsseticBundle/Controller/AsseticController.php

+ 6 - 5
src/Symfony/Bundle/AsseticBundle/Controller/AsseticController.php

@@ -83,12 +83,13 @@ class AsseticController
         return new AssetCache($asset, $this->cache);
     }
 
-    private function findAssetLeaf(AssetInterface $asset, $pos)
+    private function findAssetLeaf(\Traversable $asset, $pos)
     {
-        $leaves = array_values(iterator_to_array($asset));
-
-        if (isset($leaves[$pos])) {
-            return $leaves[$pos];
+        $i = 0;
+        foreach ($asset as $leaf) {
+            if ($pos == $i++) {
+                return $leaf;
+            }
         }
     }
 }