Esempio n. 1
0
 /**
  * Save user groups
  */
 function afterSave()
 {
     // save groups
     if (!empty($this->__groups)) {
         $groups = array_map('ucwords', (array) $this->__groups);
         if ($groups != $this->parents(static::GROUP_RELATION)) {
             $this->parents(static::GROUP_RELATION, $groups, true);
         }
         // note: put it back for data consistency
         $this->groups = $groups;
         unset($this->__groups);
     }
     return parent::afterSave();
 }
Esempio n. 2
0
 /**
  * @protected
  *
  * Create relations between steps and works or jobs, even though works and jobs
  * are mutually exclusive, manage this on the parent side.
  */
 function afterSave()
 {
     if ($this->isCreate()) {
         // Task:Instance
         $this->parents('Task', $this->task(), true);
         // WorkInstance:TaskInstance
         $this->parents(static::WORK_RELATION, $this->workInstance(), true);
     }
     // unpack uuid strings
     $this->uuid = util::unpackUuid($this->uuid);
     return parent::afterSave();
 }