From 280479c9605dbda16725fc60f9c23199c39023ca Mon Sep 17 00:00:00 2001 From: Steven Lewis Date: Fri, 15 Nov 2024 12:33:07 +0000 Subject: [PATCH 1/8] Add establishConnection() for interoperability with future versions --- src/ExtendedPdo.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ExtendedPdo.php b/src/ExtendedPdo.php index 16e28194..9917b39e 100644 --- a/src/ExtendedPdo.php +++ b/src/ExtendedPdo.php @@ -109,6 +109,18 @@ public function connect(): void } } + /** + * + * alias of connect() for interoperability with future versions Aura.Sql + * + * @return void + */ + public function establishConnection(): void + { + $this->connect(); + } + + /** * * Disconnects from the database. From 3827535a2235595f61394ccb8ac18e6ddaa975b0 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Fri, 15 Nov 2024 12:36:12 +0000 Subject: [PATCH 2/8] Update composer php requirement --- src/ExtendedPdo.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ExtendedPdo.php b/src/ExtendedPdo.php index 9917b39e..406bfac8 100644 --- a/src/ExtendedPdo.php +++ b/src/ExtendedPdo.php @@ -119,7 +119,6 @@ public function establishConnection(): void { $this->connect(); } - /** * From 7362cda4917290be5fbd44678799354bb5b5ac9b Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Fri, 15 Nov 2024 12:49:37 +0000 Subject: [PATCH 3/8] Add a deprecated notice to help users to prep for upgrading to v6 --- src/ExtendedPdo.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ExtendedPdo.php b/src/ExtendedPdo.php index 406bfac8..c0dbb428 100644 --- a/src/ExtendedPdo.php +++ b/src/ExtendedPdo.php @@ -89,6 +89,8 @@ public function __construct( * * Connects to the database. * + * @deprecated use establishConnection() as future versions will be using establishConnection() + * * @return void */ public function connect(): void From dd1f05f768a6cf509659a909c2c482c0dc747001 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Sun, 17 Nov 2024 14:58:56 +0000 Subject: [PATCH 4/8] Update docs foe the deprecation --- docs/getting-started.md | 7 +++++-- docs/upgrade.md | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 2355244d..350fa229 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -28,7 +28,10 @@ Whereas the native _PDO_ connects on instantiation, _ExtendedPdo_ does not connect immediately. Instead, it connects only when you call a method that actually needs the connection to the database; e.g., on `query()`. -If you want to force a connection, call the `connect()` method. +If you want to force a connection, call the `establishConnection()` method. + +> Previous `connect()` method has been deprecated and we encourage users move +> to using `establishConnection()` ```php // does not connect to the database @@ -42,7 +45,7 @@ $pdo = new ExtendedPdo( $pdo->exec('SELECT * FROM test'); // explicitly forces a connection -$pdo->connect(); +$pdo->establishConnection(); ``` If you want to explicitly force a disconnect, call the `disconnect()` method. diff --git a/docs/upgrade.md b/docs/upgrade.md index 80f592b3..c2a8ed04 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -1,3 +1,44 @@ +# 5.x Upgrade Notes + +Most changes are to provide better typing and compatability with PHP 8.1 and above. + +## Deprecations + +The main change is the deprecation of `ExtendedPdo::connect()` and will be changed in versions starting with 6.x + +Older Code would look like ... + +```php +// does not connect to the database +$pdo = new ExtendedPdo( + 'mysql:host=localhost;dbname=test', + 'username', + 'password' +); + +// automatically connects +$pdo->exec('SELECT * FROM test'); + +// explicitly forces a connection +$pdo->connect(); +``` +... and now needs to be changed to `ExtendedPdo::establishConnection()` + +```php +// does not connect to the database +$pdo = new ExtendedPdo( + 'mysql:host=localhost;dbname=test', + 'username', + 'password' +); + +// automatically connects +$pdo->exec('SELECT * FROM test'); + +// explicitly forces a connection +$pdo->establishConnection(); +``` + # 3.x Upgrade Notes The vast majority of changes and breaks from the 2.x version are "under the From 7a8cbe3b190603850426402097c851031df46708 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Sun, 17 Nov 2024 15:04:01 +0000 Subject: [PATCH 5/8] Update docs foe the deprecation --- docs/upgrade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/upgrade.md b/docs/upgrade.md index c2a8ed04..55f669b7 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -4,7 +4,7 @@ Most changes are to provide better typing and compatability with PHP 8.1 and abo ## Deprecations -The main change is the deprecation of `ExtendedPdo::connect()` and will be changed in versions starting with 6.x +The main change is the deprecation of `ExtendedPdo::connect()` and will be changed in future versions starting with 6.x Older Code would look like ... From cb2c4d988e8ada88be3c40f60819cdefff990cec Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Fri, 22 Nov 2024 10:34:51 +0000 Subject: [PATCH 6/8] Suggested docs updates --- docs/getting-started.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 350fa229..3740bead 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -30,8 +30,9 @@ actually needs the connection to the database; e.g., on `query()`. If you want to force a connection, call the `establishConnection()` method. -> Previous `connect()` method has been deprecated and we encourage users move -> to using `establishConnection()` +> Previous `connect()` method has been deprecated due to the introduction of +> ```PDO::connect()``` in [PHP 8.4](https://www.php.net/releases/8.4/en.php#pdo_driver_specific_subclasses), +> so we encourage users tp use `establishConnection()` instead. ```php // does not connect to the database From 8cb44f076b797d845c9b73702de9c0581ffbaa15 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Fri, 22 Nov 2024 11:52:58 +0000 Subject: [PATCH 7/8] Suggested docs updates --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 3740bead..b86b89a6 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -32,7 +32,7 @@ If you want to force a connection, call the `establishConnection()` method. > Previous `connect()` method has been deprecated due to the introduction of > ```PDO::connect()``` in [PHP 8.4](https://www.php.net/releases/8.4/en.php#pdo_driver_specific_subclasses), -> so we encourage users tp use `establishConnection()` instead. +> so we encourage users t0 use `establishConnection()` instead. ```php // does not connect to the database From 18ad9515f05954d2efa119e0ea049e2b8422a906 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Fri, 22 Nov 2024 11:53:41 +0000 Subject: [PATCH 8/8] Suggested docs updates --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index b86b89a6..12fe957d 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -32,7 +32,7 @@ If you want to force a connection, call the `establishConnection()` method. > Previous `connect()` method has been deprecated due to the introduction of > ```PDO::connect()``` in [PHP 8.4](https://www.php.net/releases/8.4/en.php#pdo_driver_specific_subclasses), -> so we encourage users t0 use `establishConnection()` instead. +> so we encourage users to use `establishConnection()` instead. ```php // does not connect to the database