2013-12-02 17:36:37 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require_once 'classes/model/om/BaseBpmnActivity.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Skeleton subclass for representing a row from the 'BPMN_ACTIVITY' table.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* You should add additional methods to this class to meet the
|
|
|
|
|
* application requirements. This class will only be generated as
|
|
|
|
|
* long as it does not already exist in the output directory.
|
|
|
|
|
*
|
|
|
|
|
* @package classes.model
|
|
|
|
|
*/
|
2013-12-23 17:17:01 -04:00
|
|
|
class BpmnActivity extends BaseBpmnActivity
|
|
|
|
|
{
|
2014-01-17 13:37:15 -04:00
|
|
|
private $bound;
|
|
|
|
|
|
|
|
|
|
public function __construct($generateUid = true)
|
|
|
|
|
{
|
|
|
|
|
$this->bound = new BpmnBound();
|
|
|
|
|
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
|
|
|
|
$this->bound->setBouElement('pm_canvas');
|
|
|
|
|
$this->bound->setBouContainer('bpmnDiagram');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* DEPRECATED, IT WILL BE REMOVED SOON
|
2013-12-23 17:17:01 -04:00
|
|
|
public function create($data, $generateUid = true)
|
|
|
|
|
{
|
|
|
|
|
// validate foreign keys, they must be present into data array
|
2013-12-02 17:36:37 -04:00
|
|
|
|
2013-12-23 17:17:01 -04:00
|
|
|
if (! array_key_exists('PRJ_UID', $data)) {
|
|
|
|
|
throw new PropelException("Error, required param 'PRJ_UID' is missing!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! array_key_exists('PRO_UID', $data)) {
|
|
|
|
|
throw new PropelException("Error, required param 'PRO_UID' is missing!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
|
|
|
|
|
|
|
|
|
if ($generateUid) {
|
|
|
|
|
$this->setActUid(\ProcessMaker\Util\Hash::generateUID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->save();
|
|
|
|
|
$process = BpmnProcessPeer::retrieveByPK($data['PRO_UID']);
|
|
|
|
|
|
|
|
|
|
// create related bound
|
|
|
|
|
$bound = new Bound();
|
|
|
|
|
$bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
|
|
|
|
$bound->setBouUid(\ProcessMaker\Util\Hash::generateUID());
|
|
|
|
|
$bound->setPrjUid($this->getPrjUid());
|
|
|
|
|
$bound->setDiaUid($process->getDiaUid());
|
|
|
|
|
$bound->setElementUid($this->getActUid());
|
|
|
|
|
$bound->setBouElementType('bpmnActivity');
|
|
|
|
|
$bound->setBouElement('pm_canvas');
|
|
|
|
|
$bound->setBouContainer('bpmnDiagram');
|
|
|
|
|
$bound->save();
|
2014-01-17 13:37:15 -04:00
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// OVERRIDES
|
|
|
|
|
|
|
|
|
|
public function fromArray($data)
|
|
|
|
|
{
|
|
|
|
|
parent::fromArray($data, BasePeer::TYPE_FIELDNAME);
|
|
|
|
|
|
|
|
|
|
// try resolve the related bound
|
|
|
|
|
if (array_key_exists('BOU_UID', $data)) {
|
|
|
|
|
//$bound = BpmnBound::findByElement('Activity', $this->getActUid());
|
|
|
|
|
$bound = BpmnBoundPeer::retrieveByPK($data['BOU_UID']);
|
|
|
|
|
|
|
|
|
|
if (is_object($bound)) {
|
|
|
|
|
$this->bound = $bound;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
2013-12-23 17:17:01 -04:00
|
|
|
}
|
|
|
|
|
|
2014-01-17 13:37:15 -04:00
|
|
|
public function save($con = null)
|
2013-12-23 17:17:01 -04:00
|
|
|
{
|
2014-01-17 13:37:15 -04:00
|
|
|
parent::save($con);
|
2013-12-23 17:17:01 -04:00
|
|
|
|
2014-01-17 13:37:15 -04:00
|
|
|
if (is_object($this->bound) && get_class($this->bound) == 'BpmnBound') {
|
|
|
|
|
$this->bound->save($con);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
|
|
|
|
{
|
|
|
|
|
$data = parent::toArray($keyType);
|
|
|
|
|
|
|
|
|
|
if (is_object($this->bound) && get_class($this->bound) == 'BpmnBound') {
|
|
|
|
|
$data = array_merge($data, $this->bound->toArray($keyType));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $data;
|
2013-12-23 17:17:01 -04:00
|
|
|
}
|
2014-01-17 13:37:15 -04:00
|
|
|
|
2013-12-02 17:36:37 -04:00
|
|
|
} // BpmnActivity
|