summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Logging/Statement.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
committerpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
commitbf6655a534a6775d30cafa67bd801276bda1d98d (patch)
treec6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/dbal/src/Logging/Statement.php
parent94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff)
downloadAppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/dbal/src/Logging/Statement.php')
-rw-r--r--vendor/doctrine/dbal/src/Logging/Statement.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Logging/Statement.php b/vendor/doctrine/dbal/src/Logging/Statement.php
new file mode 100644
index 0000000..ed1ca7f
--- /dev/null
+++ b/vendor/doctrine/dbal/src/Logging/Statement.php
@@ -0,0 +1,48 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Logging;
6
7use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware;
8use Doctrine\DBAL\Driver\Result as ResultInterface;
9use Doctrine\DBAL\Driver\Statement as StatementInterface;
10use Doctrine\DBAL\ParameterType;
11use Psr\Log\LoggerInterface;
12
13final class Statement extends AbstractStatementMiddleware
14{
15 /** @var array<int,mixed>|array<string,mixed> */
16 private array $params = [];
17
18 /** @var array<int,ParameterType>|array<string,ParameterType> */
19 private array $types = [];
20
21 /** @internal This statement can be only instantiated by its connection. */
22 public function __construct(
23 StatementInterface $statement,
24 private readonly LoggerInterface $logger,
25 private readonly string $sql,
26 ) {
27 parent::__construct($statement);
28 }
29
30 public function bindValue(int|string $param, mixed $value, ParameterType $type): void
31 {
32 $this->params[$param] = $value;
33 $this->types[$param] = $type;
34
35 parent::bindValue($param, $value, $type);
36 }
37
38 public function execute(): ResultInterface
39 {
40 $this->logger->debug('Executing statement: {sql} (parameters: {params}, types: {types})', [
41 'sql' => $this->sql,
42 'params' => $this->params,
43 'types' => $this->types,
44 ]);
45
46 return parent::execute();
47 }
48}