From 553d6293a9e5ded23957dba21cc7125fcdf03e7f Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 11 Jan 2019 10:08:45 -0400 Subject: [PATCH] PMC-325 --- .../creole/contrib/DBArrayConnection.php | 22 ++++++++----------- workflow/engine/classes/DbConnections.php | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/thirdparty/creole/contrib/DBArrayConnection.php b/thirdparty/creole/contrib/DBArrayConnection.php index a7cbcff75..9b8edef71 100644 --- a/thirdparty/creole/contrib/DBArrayConnection.php +++ b/thirdparty/creole/contrib/DBArrayConnection.php @@ -523,19 +523,15 @@ class DBArrayConnection implements Connection } } - //prepend the headers in the resultRow - array_unshift($resultRow, $this->_DBArray[$tableName][0]); - //$resultRow[0] = $this->_DBArray[ $tableName ][0]; - - /* algorith to order a multiarray - // Obtain a list of columns - foreach ($data as $key => $row) { - $volume[$key] = $row['volume']; - $edition[$key] = $row['edition']; - } - // Sort the data with volume descending, edition ascending - // Add $data as the last parameter, to sort by the common key - array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); */ + /** + * Prepend the headers in the resultRow. + * If the null value is not taken, $resultRow will lose an element. + */ + $header = null; + if (isset($this->_DBArray[$tableName][0])) { + $header = $this->_DBArray[$tableName][0]; + } + array_unshift($resultRow, $header); /* * Apply Limit and Offset diff --git a/workflow/engine/classes/DbConnections.php b/workflow/engine/classes/DbConnections.php index 22962ec0f..784d97230 100644 --- a/workflow/engine/classes/DbConnections.php +++ b/workflow/engine/classes/DbConnections.php @@ -194,7 +194,7 @@ class DbConnections $conf = Propel::getConfiguration(); // Iterate through the datasources of configuration, and only care about workflow, rbac or rp. Remove anything else. foreach ($conf['datasources'] as $key => $val) { - if (!in_array($key, ['workflow', 'rbac', 'rp'])) { + if (!in_array($key, ['workflow', 'rbac', 'rp', 'dbarray'])) { unset($conf['datasources'][$key]); } }