浏览代码

Merge pull request #1351 from ddebree/PR1345

Fix for PR1345 - Form groups missing description
Thomas 12 年之前
父节点
当前提交
d628544163
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Mapper/BaseGroupedMapper.php

+ 7 - 1
Mapper/BaseGroupedMapper.php

@@ -67,8 +67,11 @@ abstract class BaseGroupedMapper extends BaseMapper
      */
     protected function addFieldToCurrentGroup($fieldName) 
     {
+        //Note this line must happen before the next line. 
+        //See https://github.com/sonata-project/SonataAdminBundle/pull/1351
+        $currentGroup = $this->getCurrentGroupName();
         $groups = $this->getGroups();
-        $groups[$this->getCurrentGroupName()]['fields'][$fieldName] = $fieldName;
+        $groups[$currentGroup]['fields'][$fieldName] = $fieldName;
         $this->setGroups($groups);
     }
     
@@ -76,6 +79,9 @@ abstract class BaseGroupedMapper extends BaseMapper
      * Return the name of the currently selected group. The method also makes 
      * sure a valid group name is currently selected
      * 
+     * Note that this can have the side effect to change the "group" value
+     * returned by the getGroup function
+     * 
      * @return string
      */
     protected function getCurrentGroupName()