@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class BpmnProcess
|
||||
{
|
||||
/**
|
||||
* Update all processes data by project uid
|
||||
* @param $prjUid
|
||||
* @param $data
|
||||
* @throws \PropelException
|
||||
*/
|
||||
public function updateAllProcessesByProject($prjUid, $data)
|
||||
{
|
||||
$oCriteria = new \Criteria();
|
||||
$oCriteria->addSelectColumn(\BpmnProcessPeer::PRO_UID);
|
||||
$oCriteria->add(\BpmnProcessPeer::PRJ_UID, $prjUid);
|
||||
$rs = \BpmnProcessPeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
if (!empty($data['PRO_UID'])) {
|
||||
unset($data['PRO_UID']);
|
||||
}
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
$project = \BpmnProcessPeer::retrieveByPK($row['PRO_UID']);
|
||||
if (!empty($project)) {
|
||||
$project->fromArray($data, \BasePeer::TYPE_FIELDNAME);
|
||||
$project->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class BpmnProject
|
||||
{
|
||||
public function update($prj_uid, $data)
|
||||
{
|
||||
$project = \BpmnProjectPeer::retrieveByPK($prj_uid);
|
||||
$project->fromArray($data, \BasePeer::TYPE_FIELDNAME);
|
||||
$project->save();
|
||||
}
|
||||
}
|
||||
@@ -562,6 +562,12 @@ class Process
|
||||
$this->throwExceptionIfNotExistsUser($arrayData["PRO_CREATE_USER"], $this->arrayFieldNameForException["processCreateUser"]);
|
||||
}
|
||||
|
||||
//Update name in table Bpmn_Project and Bpmn_Process
|
||||
$oProject = new BpmnProject();
|
||||
$oProject->update($processUid, array('PRJ_NAME'=>$arrayData['PRO_TITLE']));
|
||||
$oProcess = new BpmnProcess();
|
||||
//The relationship Bpmn_Project with Bpmn_Process is 1:n
|
||||
$oProcess->updateAllProcessesByProject($processUid, array('PRO_NAME'=>$arrayData['PRO_TITLE']));
|
||||
//Update
|
||||
$process = new \Process();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user