From 555c444b4e283261d2efe376b5803e0adbf5e214 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 Jul 2019 16:08:48 +0000 Subject: [PATCH] Moved function to Database.php --- src/Database/DBA.php | 2 +- src/Database/Database.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Database/DBA.php b/src/Database/DBA.php index 937693a792..4619bc38b8 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -422,7 +422,7 @@ class DBA */ public static function selectToArray($table, array $fields = [], array $condition = [], array $params = []) { - return self::$database->toArray(self::$database->select($table, $fields, $condition, $params)); + return self::$database->selectToArray($table, $fields, $condition, $params); } /** diff --git a/src/Database/Database.php b/src/Database/Database.php index c503416912..566a757b51 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1407,6 +1407,23 @@ class Database } } + /** + * @brief Select rows from a table and fills an array with the data + * + * @param string $table Table name + * @param array $fields Array of selected fields, empty for all + * @param array $condition Array of fields for condition + * @param array $params Array of several parameters + * + * @return array Data array + * @throws \Exception + * @see self::select + */ + public function selectToArray($table, array $fields = [], array $condition = [], array $params = []) + { + return $this->toArray($this->select($table, $fields, $condition, $params)); + } + /** * @brief Select rows from a table * -- 2.39.5