Пример #1
0
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if (isset($this->originalAttributeValues['group']) && $this->originalAttributeValues['group'][1] > 0) {
             //copy to new object, so we can populate the old parent group as the related group.
             //otherwise it gets passed by reference. We need the old $this->group information to properly
             //utilize the groupBeingRemovedFromGroup method.
             $group = unserialize(serialize($this));
             $group->group = Group::getById($this->originalAttributeValues['group'][1]);
             AllPermissionsOptimizationUtil::groupBeingRemovedFromGroup($group);
             assert('$this->originalAttributeValues["group"][1] != $this->group->id');
         }
         return true;
     } else {
         return false;
     }
 }