diff --git a/workflow/engine/src/BusinessModel/DataBaseConnection.php b/workflow/engine/src/BusinessModel/DataBaseConnection.php index fe5de0b06..ba055d98d 100644 --- a/workflow/engine/src/BusinessModel/DataBaseConnection.php +++ b/workflow/engine/src/BusinessModel/DataBaseConnection.php @@ -100,22 +100,7 @@ class DataBaseConnection if (isset($dataDBConnection['DBS_TYPE'])) { $typesExists = array(); - G::LoadClass( 'dbConnections' ); - $dbs = new dbConnections($pro_uid); - $dbServices = $dbs->getDbServicesAvailables(); - foreach ($dbServices as $value) { - $typesExists[] = $value['id']; - } - if (!in_array($dataDBConnection['DBS_TYPE'], $typesExists)) { - throw (new \Exception("This 'dbs_type' is invalid")); - } - } - - if (isset($dataDBConnection['DBS_TYPE'])) { - $typesExists = array(); - - $dbs = new dbConnections($pro_uid); - $dbServices = $dbs->getDbServicesAvailables(); + $dbServices = $this->getDbEngines(); foreach ($dbServices as $value) { $typesExists[] = $value['id']; } @@ -313,6 +298,23 @@ class DataBaseConnection } } + /** + * Get Data Base Engines + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return array + */ + public function getDbEngines () { + if (!class_exists('dbConnections')) { + G::LoadClass('dbConnections'); + } + $dbs = new dbConnections(); + $dbServices = $dbs->getDbServicesAvailables(); + return $dbServices; + } + /** * Validate Process Uid * @var string $pro_uid. Uid for process diff --git a/workflow/engine/src/Services/Api/ProcessMaker/System.php b/workflow/engine/src/Services/Api/ProcessMaker/System.php new file mode 100644 index 000000000..89763b3f9 --- /dev/null +++ b/workflow/engine/src/Services/Api/ProcessMaker/System.php @@ -0,0 +1,33 @@ + + * @copyright Colosa - Bolivia + * + * @url GET /dbEngines + */ + public function doGetDataBaseEngines() + { + try { + $oDBConnection = new \BusinessModel\DataBaseConnection(); + $response = $oDBConnection->getDbEngines(); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } +} +