Ejemplo n.º 1
0
 /**
  * overwrite user with old values and xml with new values
  *
  * @param User $user
  * @param array $dirtyProperties
  * @return User $user
  */
 public static function rollbackUserWithChangeRequest($user, $dirtyProperties)
 {
     $existingProperties = $user->_getCleanProperties();
     // reset old values
     $user->setUserGroup($existingProperties['usergroup']);
     foreach ($dirtyProperties as $propertyName => $propertyValue) {
         $propertyValue = null;
         $user->{'set' . ucfirst($propertyName)}($existingProperties[$propertyName]);
     }
     // store changes as xml in field fe_users.tx_femanager_changerequest
     $user->setTxFemanagerChangerequest(GeneralUtility::array2xml($dirtyProperties, '', 0, 'changes'));
     return $user;
 }