From 290bccedb47fee9706f0d17227ab596ebeee9ade Mon Sep 17 00:00:00 2001 From: Val Bancer Date: Sat, 25 Aug 2018 23:19:26 +0200 Subject: [PATCH 1/4] Add missing method definitions --- lib/Cake/Model/Datasource/DboSource.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index cc59edbb3..8c2383849 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -272,6 +272,16 @@ class DboSource extends DataSource { } } +/** + * Connects to the database. + * + * @return bool + */ + public function connect() { + // This method is implemented in subclasses + return $this->connected; + } + /** * Reconnects to database server with optional new settings * @@ -619,6 +629,16 @@ class DboSource extends DataSource { } } +/** + * Builds a map of the columns contained in a result + * + * @param array|PDOStatement $results The results to format. + * @return void + */ + public function resultSet($results) { + // This method is implemented in subclasses + } + /** * Returns a row from current resultset as an array * From c5d78b6302f755fc944be967aa8eec90e3e112a9 Mon Sep 17 00:00:00 2001 From: Val Bancer Date: Sun, 26 Aug 2018 01:24:18 +0200 Subject: [PATCH 2/4] Remove duplicate connect method from the unit test stub --- lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php index 597490d60..379d1a472 100644 --- a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php +++ b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php @@ -231,7 +231,6 @@ class CakeTestFixtureTest extends CakeTestCase { public function setUp() { parent::setUp(); $methods = array_diff(get_class_methods('DboSource'), array('enabled')); - $methods[] = 'connect'; $this->criticDb = $this->getMock('DboSource', $methods); $this->criticDb->fullDebug = true; From 2aa8fac574a52a26272f5458adf80584c384db91 Mon Sep 17 00:00:00 2001 From: Val Bancer Date: Sun, 26 Aug 2018 01:58:56 +0200 Subject: [PATCH 3/4] Fix resultSet() method signature --- lib/Cake/Model/Datasource/Database/Postgres.php | 4 ++-- lib/Cake/Model/Datasource/DboSource.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 2bf200fee..c56ccf214 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -765,10 +765,10 @@ class Postgres extends DboSource { /** * resultSet method * - * @param array &$results The results + * @param PDOStatement $results The results * @return void */ - public function resultSet(&$results) { + public function resultSet($results) { $this->map = array(); $numFields = $results->columnCount(); $index = 0; diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 8c2383849..876284f30 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -632,7 +632,7 @@ class DboSource extends DataSource { /** * Builds a map of the columns contained in a result * - * @param array|PDOStatement $results The results to format. + * @param PDOStatement $results The results to format. * @return void */ public function resultSet($results) { From df1c25f4cfe7a878d04a374094381841e1574617 Mon Sep 17 00:00:00 2001 From: Val Bancer Date: Sun, 26 Aug 2018 02:23:29 +0200 Subject: [PATCH 4/4] Fix documentation of resultSet method --- lib/Cake/Model/Datasource/Database/Sqlite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index 2cf39c356..749d73b9a 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -299,7 +299,7 @@ class Sqlite extends DboSource { /** * Generate ResultSet * - * @param mixed $results The results to modify. + * @param PDOStatement $results The results to modify. * @return void */ public function resultSet($results) {