| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Doctrine\DBAL\Driver\Middleware;
|
|
|
4 |
|
|
|
5 |
use Doctrine\DBAL\Driver\Result;
|
|
|
6 |
use Doctrine\DBAL\Driver\Statement;
|
|
|
7 |
use Doctrine\DBAL\ParameterType;
|
|
|
8 |
use Doctrine\Deprecations\Deprecation;
|
|
|
9 |
|
|
|
10 |
use function func_num_args;
|
|
|
11 |
|
|
|
12 |
abstract class AbstractStatementMiddleware implements Statement
|
|
|
13 |
{
|
|
|
14 |
private Statement $wrappedStatement;
|
|
|
15 |
|
|
|
16 |
public function __construct(Statement $wrappedStatement)
|
|
|
17 |
{
|
|
|
18 |
$this->wrappedStatement = $wrappedStatement;
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* {@inheritdoc}
|
|
|
23 |
*/
|
|
|
24 |
public function bindValue($param, $value, $type = ParameterType::STRING)
|
|
|
25 |
{
|
|
|
26 |
if (func_num_args() < 3) {
|
|
|
27 |
Deprecation::trigger(
|
|
|
28 |
'doctrine/dbal',
|
|
|
29 |
'https://github.com/doctrine/dbal/pull/5558',
|
|
|
30 |
'Not passing $type to Statement::bindValue() is deprecated.'
|
|
|
31 |
. ' Pass the type corresponding to the parameter being bound.',
|
|
|
32 |
);
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
return $this->wrappedStatement->bindValue($param, $value, $type);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* {@inheritdoc}
|
|
|
40 |
*
|
|
|
41 |
* @deprecated Use {@see bindValue()} instead.
|
|
|
42 |
*/
|
|
|
43 |
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
|
|
|
44 |
{
|
|
|
45 |
Deprecation::trigger(
|
|
|
46 |
'doctrine/dbal',
|
|
|
47 |
'https://github.com/doctrine/dbal/pull/5563',
|
|
|
48 |
'%s is deprecated. Use bindValue() instead.',
|
|
|
49 |
__METHOD__,
|
|
|
50 |
);
|
|
|
51 |
|
|
|
52 |
if (func_num_args() < 3) {
|
|
|
53 |
Deprecation::trigger(
|
|
|
54 |
'doctrine/dbal',
|
|
|
55 |
'https://github.com/doctrine/dbal/pull/5558',
|
|
|
56 |
'Not passing $type to Statement::bindParam() is deprecated.'
|
|
|
57 |
. ' Pass the type corresponding to the parameter being bound.',
|
|
|
58 |
);
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
return $this->wrappedStatement->bindParam($param, $variable, $type, $length);
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* {@inheritdoc}
|
|
|
66 |
*/
|
|
|
67 |
public function execute($params = null): Result
|
|
|
68 |
{
|
|
|
69 |
return $this->wrappedStatement->execute($params);
|
|
|
70 |
}
|
|
|
71 |
}
|