Skip to content

Commit

Permalink
PDO according to 8.4 changes and feedbacks from @pmjones #231 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
harikt committed Dec 21, 2024
1 parent 820ea99 commit e6f9904
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 110 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
vendor/*
.phpunit.result.cache
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ 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 `establishConnection()` method.
If you want to force a connection, call the `lazyConnect()` method.

```php
// does not connect to the database
Expand All @@ -56,7 +56,7 @@ $pdo = new ExtendedPdo(
$pdo->exec('SELECT * FROM test');

// explicitly forces a connection
$pdo->establishConnection();
$pdo->lazyConnect();
```

If you want to explicitly force a disconnect, call the `disconnect()` method.
Expand Down
11 changes: 5 additions & 6 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Most changes are to provide better compatability with PHP 8.4 and above.

With PHP 8.4 introducing `Pdo::connect()` as a way of creating driver specific connections.

We have introducing our `ExtendedPdo::connect()` which uses the underlining PDO features then with all our
normal added features.
`ExtendedPdo::connect()` will be still using only the PDO and not subclass feature.
If you want to use the subclass feature use the `DecoratedPdo` passing the pdo instance directly.

```php
// does not connect to the database
Expand All @@ -19,7 +19,7 @@ $pdo = ExtendedPdo::connect(
$pdo->exec('SELECT * FROM test');

// explicitly forces a connection
$pdo->establishConnection();
$pdo->lazyConnect();
```

# 5.x Upgrade Notes
Expand All @@ -46,7 +46,7 @@ $pdo->exec('SELECT * FROM test');
// explicitly forces a connection
$pdo->connect();
```
... and now needs to be changed to `ExtendedPdo::establishConnection()`
... and now needs to be changed to `ExtendedPdo::lazyConnect()`

```php
// does not connect to the database
Expand All @@ -60,7 +60,7 @@ $pdo = new ExtendedPdo(
$pdo->exec('SELECT * FROM test');

// explicitly forces a connection
$pdo->establishConnection();
$pdo->lazyConnect();
```

# 3.x Upgrade Notes
Expand Down Expand Up @@ -298,4 +298,3 @@ underlying PDO instance to make those methods available, if they exist.

- When dumping an ExtendedPdo object, the username and password are omitted. This
should help keep unexpected output of stack traces from revealing credentials.

Loading

0 comments on commit e6f9904

Please sign in to comment.