浏览代码

Fixed ExprBuilder to really use the parameter when replacing a key with an attribute

Christophe Coevoet 14 年之前
父节点
当前提交
1305728502
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php

+ 3 - 3
src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php

@@ -101,11 +101,11 @@ class ExprBuilder
      */
     public function thenReplaceKeyWithAttribute($attribute)
     {
-        $this->thenPart = function($v) {
+        $this->thenPart = function($v) use ($attribute) {
             $newValue = array();
             foreach ($v as $k => $oldValue) {
-                if (is_array($oldValue) && isset($oldValue['id'])) {
-                    $k = $oldValue['id'];
+                if (is_array($oldValue) && isset($oldValue[$attribute])) {
+                    $k = $oldValue[$attribute];
                 }
 
                 $newValue[$k] = $oldValue;