1 | <?php |
||
27 | class DB extends AbstractAnonymizer |
||
28 | { |
||
29 | /** |
||
30 | * Zend DB Adapter |
||
31 | * |
||
32 | * @var \Doctrine\DBAL\Connection |
||
33 | */ |
||
34 | private $conn; |
||
35 | |||
36 | /** |
||
37 | * Constructor |
||
38 | * |
||
39 | * @param $params Parameters to send to Doctrine DB |
||
40 | */ |
||
41 | public function __construct(array $params) |
||
45 | |||
46 | 16 | /** |
|
47 | * Process an entity by reading / writing to the DB |
||
48 | 16 | * |
|
49 | 16 | * @param string $table |
|
50 | 16 | * @param callable|null $callback |
|
51 | * @param bool $pretend |
||
52 | * @param bool $returnResult |
||
53 | * |
||
54 | * @return void|array |
||
55 | */ |
||
56 | public function processEntity( |
||
106 | |||
107 | 8 | ||
108 | /** |
||
109 | * Get Doctrine Connection |
||
110 | * @return Doctrine\DBAL\Connection |
||
111 | */ |
||
112 | public function getConn() |
||
116 | |||
117 | 10 | ||
118 | /** |
||
119 | * Identify the primary key for a table |
||
120 | 10 | * |
|
121 | 1 | * @param string $table |
|
122 | 1 | * |
|
123 | * @return string Field's name |
||
124 | */ |
||
125 | 9 | protected function getPrimaryKey(string $table) |
|
135 | |||
136 | |||
137 | /** |
||
138 | * Identify the primary key for a table |
||
139 | * |
||
140 | * @param string $table |
||
141 | * |
||
142 | 5 | * @return array $cols |
|
143 | */ |
||
144 | 5 | protected function getTableCols(string $table) |
|
157 | 1 | ||
158 | |||
159 | 4 | /** |
|
160 | * Execute the Update with PDO |
||
161 | * |
||
162 | * @param string $table Name of the table |
||
163 | * @param array $data Array of fields => value to update the table |
||
164 | * @param string $primaryKey |
||
165 | * @param string $val Primary Key's Value |
||
166 | * @return string Doctrine DBAL QueryBuilder |
||
167 | */ |
||
168 | private function prepareUpdate(string $table, array $data, string $primaryKey, $val) |
||
182 | |||
183 | |||
184 | /** |
||
185 | * Execute the Update with PDO |
||
186 | * |
||
187 | * @param QueryBuilder $queryBuilder |
||
188 | * @param string $table Name of the table |
||
189 | 4 | */ |
|
190 | private function runUpdate(QueryBuilder $queryBuilder, string $table) |
||
198 | |||
199 | 3 | ||
200 | 1 | /** |
|
201 | 1 | * To debug, build the final SQL (can be approximative) |
|
202 | * @param QueryBuilder $queryBuilder |
||
203 | * @return string |
||
204 | 2 | */ |
|
205 | private function getRawSQL(QueryBuilder $queryBuilder) |
||
214 | |||
215 | |||
216 | 6 | /** |
|
217 | * Execute the Delete with PDO |
||
218 | 6 | * |
|
219 | 6 | * @param string $table |
|
220 | 6 | * @param string $where |
|
221 | * @param bool $pretend |
||
222 | * |
||
223 | 6 | * @return string |
|
224 | */ |
||
225 | 6 | private function runDelete(string $table, string $where, bool $pretend): string |
|
246 | } |
||
247 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: