Browse Source

Merge pull request #1351 from ddebree/PR1345

Fix for PR1345 - Form groups missing description
Thomas 12 years ago
parent
commit
d628544163
1 changed files with 7 additions and 1 deletions
  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()