示例#1
0
 /**
  * Advance the workflow step for the event if requested.
  *
  * @param Event $event
  *
  * @throws CException
  */
 protected function afterUpdateElements($event)
 {
     parent::afterUpdateElements($event);
     $this->persistPcrRisk();
     if ($this->step) {
         // Advance the workflow
         if (!($assignment = models\OphCiExamination_Event_ElementSet_Assignment::model()->find('event_id = ?', array($event->id)))) {
             // Create initial workflow assignment if event hasn't already got one
             $assignment = new models\OphCiExamination_Event_ElementSet_Assignment();
             $assignment->event_id = $event->id;
         }
         if (!($next_step = $this->getNextStep($event))) {
             throw new \CException('No next step available');
         }
         $assignment->step_id = $next_step->id;
         if (!$assignment->save()) {
             throw new \CException('Cannot save assignment');
         }
     }
 }