@@ -1502,6 +1502,26 @@ class Processes
|
||||
return $oTask->createRouteRows($aRoutes);
|
||||
}
|
||||
|
||||
/**
|
||||
* This string replace duplicated routes based on the tasks origin and end
|
||||
* if the route existed is removed and regenerated since probably the last
|
||||
* data is an updated version and we need a different functionality than the
|
||||
* createRouteRows method.
|
||||
* @param $aRoutes array
|
||||
* @return $oTask Tasks array
|
||||
*/
|
||||
public function replaceRouteRows($aRoutes)
|
||||
{
|
||||
foreach ($aRoutes as $routeData) {
|
||||
$route = new \Route();
|
||||
foreach ($route->routeExistsFiltered($routeData) as $duplicatedRoute) {
|
||||
$routeData = array_replace_recursive($duplicatedRoute, $routeData);
|
||||
$route->remove($duplicatedRoute['ROU_UID']);
|
||||
}
|
||||
$route->create($routeData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Route Rows from a $aRoutes array data and returns those in an array.
|
||||
*
|
||||
|
||||
@@ -252,6 +252,31 @@ class Route extends BaseRoute
|
||||
}
|
||||
}
|
||||
|
||||
public function routeExistsFiltered($aData)
|
||||
{
|
||||
$con = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||
try {
|
||||
if (!empty($aData)) {
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn("ROUTE.*");
|
||||
$c->add(RoutePeer::PRO_UID, $aData['PRO_UID'], Criteria::EQUAL);
|
||||
$c->add(RoutePeer::TAS_UID, $aData['TAS_UID'], Criteria::EQUAL);
|
||||
$c->add(RoutePeer::ROU_NEXT_TASK, $aData['ROU_NEXT_TASK'], Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$query =$c->toString();
|
||||
$rs = RoutePeer::doSelectRS($c);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$routes = array();
|
||||
while ($rs->next()) {
|
||||
$routes[] = $rs->getRow();
|
||||
}
|
||||
return $routes;
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate value for a variable that only accepts some determinated values
|
||||
*
|
||||
|
||||
@@ -150,7 +150,7 @@ class GranularExporter
|
||||
protected function mergeData($migratorData)
|
||||
{
|
||||
$migratorData = $this->verifyConsistenceData($migratorData);
|
||||
$this->data = array_merge_recursive($this->data, $migratorData);
|
||||
$this->data = array_replace_recursive($migratorData, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,12 +56,13 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
||||
//Workflow elements
|
||||
$this->processes->updateProcessRow($data['workflow']['process']);
|
||||
$this->processes->createTaskRows($data['workflow']['tasks']);
|
||||
$this->processes->createTaskUserRows($data['workflow']['taskusers']);
|
||||
$this->processes->createRouteRows($data['workflow']['routes']);
|
||||
$this->processes->replaceRouteRows($data['workflow']['routes']);
|
||||
$this->processes->createLaneRows($data['workflow']['lanes']);
|
||||
$this->processes->createGatewayRows($data['workflow']['gateways']);
|
||||
$this->processes->createStepRows($data['workflow']['steps']);
|
||||
$this->processes->createStepTriggerRows($data['workflow']['steptriggers']);
|
||||
$this->processes->createTaskUserRows($data['workflow']['taskusers']);
|
||||
$this->processes->createSubProcessRows($data['workflow']['subProcess']);
|
||||
$this->processes->createCaseTrackerRows($data['workflow']['caseTracker']);
|
||||
$this->processes->createCaseTrackerObjectRows($data['workflow']['caseTrackerObject']);
|
||||
|
||||
Reference in New Issue
Block a user