浏览代码

Fixed Tree Strategy cacheing

Due to re-use of $class variable name, the correct strategy was actually not correctly cached in the first getStrategy run.
philipp.feigl 13 年之前
父节点
当前提交
4d3ac77456
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lib/Gedmo/Tree/TreeListener.php

+ 3 - 3
lib/Gedmo/Tree/TreeListener.php

@@ -70,11 +70,11 @@ class TreeListener extends MappedEventSubscriber
                 $managerName = 'ODM';
             }
             if (!isset($this->strategyInstances[$config['strategy']])) {
-                $class = $this->getNamespace().'\\Strategy\\'.$managerName.'\\'.ucfirst($config['strategy']);
-                if (!class_exists($class)) {
+                $strategyClass = $this->getNamespace().'\\Strategy\\'.$managerName.'\\'.ucfirst($config['strategy']);
+                if (!class_exists($strategyClass)) {
                     throw new \Gedmo\Exception\InvalidArgumentException($managerName." TreeListener does not support tree type: {$config['strategy']}");
                 }
-                $this->strategyInstances[$config['strategy']] = new $class($this);
+                $this->strategyInstances[$config['strategy']] = new $strategyClass($this);
             }
             $this->strategies[$class] = $config['strategy'];
         }