Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ReconnectMiddleware | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| wrap | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Satag\AmicronEntityBundle\Doctrine\Middleware; |
| 6 | |
| 7 | use Doctrine\DBAL\Driver; |
| 8 | use Doctrine\DBAL\Driver\Connection; |
| 9 | use Doctrine\DBAL\Driver\Middleware; |
| 10 | use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; |
| 11 | |
| 12 | /** |
| 13 | * DBAL middleware that wraps the Firebird driver to provide automatic reconnection |
| 14 | * on stale/broken connection handles (Firebird idle-timeout disconnects). |
| 15 | * |
| 16 | * Registered via doctrine.middleware tag in service.xml. |
| 17 | * Compose order: ReconnectMiddleware → CharsetMiddleware → FirebirdDriver |
| 18 | */ |
| 19 | final class ReconnectMiddleware implements Middleware |
| 20 | { |
| 21 | public function wrap(Driver $driver): Driver |
| 22 | { |
| 23 | return new class($driver) extends AbstractDriverMiddleware { |
| 24 | public function connect( |
| 25 | #[\SensitiveParameter] |
| 26 | array $params, |
| 27 | ): Connection { |
| 28 | return new ReconnectConnection( |
| 29 | parent::connect($params), |
| 30 | $this, |
| 31 | $params, |
| 32 | ); |
| 33 | } |
| 34 | }; |
| 35 | } |
| 36 | } |