Пример #1
0
 /**
  * @constructor
  *
  * Instantiate steps from Work model.
  */
 public function __construct($data = null)
 {
     if ($data instanceof Work) {
         $this->work($data);
         // note; Take the value copy of parent Work model.
         $data = $data->data();
         array_remove_keys($data, array('uuid', 'tasks', 'timestamp'));
         $data = array_filter($data);
     }
     parent::__construct($data);
 }
Пример #2
0
 /**
  * @constructor
  */
 public function __construct($data = null)
 {
     if ($data instanceof Task) {
         // relation: Task
         $this->task($data);
         // Also stores the task identity "$name@$version"
         $this->identity = str_replace('@', '@~', $data->identity());
         $this->name = $data->name;
         $this->version = $data->version;
         $this->type = $data->extra['type'];
         $this->extra = array_select($data->extra, array('name', 'endpoint'));
         if (isset($data->settings)) {
             $this->settings = $data->settings;
         }
         // Copy fields from Task model
         $data = $data->data();
     } else {
         parent::__construct($data);
     }
 }