Adicion de validaciones para campos requeridos en PROJECTS
This commit is contained in:
@@ -493,6 +493,30 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
public static function createFromStruct(array $projectData, $generateUid = true)
|
||||
{
|
||||
if (\Process::existsByProTitle($projectData["prj_name"])) {
|
||||
throw new \Exception("Project with name: {$projectData["prj_name"]}, already exists.");
|
||||
}
|
||||
$activities = $projectData['diagrams']['0']['activities'];
|
||||
foreach($activities as $value) {
|
||||
if (empty($value['act_name'])) {
|
||||
throw new \Exception("For activity: {$value['act_uid']} `act_name` is required but missing.");
|
||||
}
|
||||
if (empty($value['act_type'])) {
|
||||
throw new \Exception("For activity: {$value['act_uid']} `act_type` is required but missing.");
|
||||
}
|
||||
}
|
||||
$events = $projectData['diagrams']['0']['events'];
|
||||
foreach($events as $value) {
|
||||
if (empty($value['evn_name'])) {
|
||||
throw new \Exception("For event: {$value['evn_uid']} `evn_name` is required but missing.");
|
||||
}
|
||||
if (empty($value['evn_type'])) {
|
||||
throw new \Exception("For event: {$value['evn_uid']} `evn_type` is required but missing.");
|
||||
}
|
||||
if (empty($value['evn_marker'])) {
|
||||
throw new \Exception("For event: {$value['evn_uid']} `evn_marker` is required but missing.");
|
||||
}
|
||||
}
|
||||
$bwp = new self;
|
||||
$result = array();
|
||||
$data = array();
|
||||
|
||||
Reference in New Issue
Block a user