Adding merge support for the Process Definition, Variables, Dynaforms, Input and output documents.
This commit is contained in:
@@ -5,6 +5,6 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
||||
interface Importable
|
||||
{
|
||||
public function beforeImport($data);
|
||||
public function import($data);
|
||||
public function import($data, $replace);
|
||||
public function afterImport($data);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,14 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
public function import($data)
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
$this->bpmn->createFromStruct($data, false);
|
||||
if ($replace) {
|
||||
$this->bpmn->createFromStruct($data, false);
|
||||
} else {
|
||||
$this->bpmn->updateFromStruct($data['PRJ_UID'], $data, false);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
@@ -32,10 +32,14 @@ class VariablesMigrator implements Importable, Exportable
|
||||
* Imports the process variables
|
||||
* @param $data
|
||||
*/
|
||||
public function import($data)
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
$this->processes->createProcessVariables($data);
|
||||
if ($replace) {
|
||||
$this->processes->createProcessVariables($data);
|
||||
} else {
|
||||
$this->processes->updateProcessVariables($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Logger::log($e->getMessage());
|
||||
throw new ImportException($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user