Adding put method for /project endpoint (1st commit - still not functional)
This commit is contained in:
@@ -14,6 +14,50 @@ require_once 'classes/model/om/BaseBpmnActivity.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class BpmnActivity extends BaseBpmnActivity {
|
||||
class BpmnActivity extends BaseBpmnActivity
|
||||
{
|
||||
public function create($data, $generateUid = true)
|
||||
{
|
||||
// validate foreign keys, they must be present into data array
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public function update($data)
|
||||
{
|
||||
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$this->save();
|
||||
|
||||
// update related bound
|
||||
$bound = BpmnBound::findOneBy(BpmnBoundPeer::ELEMENT_UID, $this->getActUid());
|
||||
$bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$bound->save();
|
||||
}
|
||||
} // BpmnActivity
|
||||
|
||||
@@ -14,6 +14,18 @@ require_once 'classes/model/om/BaseBpmnBound.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class BpmnBound extends BaseBpmnBound {
|
||||
class BpmnBound extends BaseBpmnBound
|
||||
{
|
||||
public static function findOneBy($field, $value)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
|
||||
$c->add($field, $value, CRITERIA::EQUAL );
|
||||
|
||||
$rs = ContentPeer::doSelectRS($c);
|
||||
//$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
|
||||
return $rs->getRow();
|
||||
}
|
||||
} // BpmnBound
|
||||
|
||||
Reference in New Issue
Block a user