/**
  * Prepares attributes before performing validation.
  */
 protected function beforeValidate()
 {
     parent::beforeValidate();
     if ($this->isNewRecord) {
         $this->status = $this->swBehavior->swGetStatus()->toString();
     }
     return true;
 }
 public function afterTransition($event)
 {
     $transition = array();
     $transition['type'] = 'after';
     $transition['modelName'] = get_class($event->sender);
     $transition['modelId'] = $event->sender->primaryKey;
     $transition['stateFrom'] = $event->source->getId();
     $transition['stateTo'] = $event->destination->getId();
     $transition['time'] = date('Y-m-d H:i:s');
     $transition['requestIds'] = SWLogActiveRecord::$requestIds;
     SWLogActiveRecord::$requestIds = array();
     //VarDumper::dump($transition);
     WorkflowStates::setTransition($transition);
     return parent::beforeTransition($event);
 }
Beispiel #3
0
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }