1 | <?php |
||
16 | abstract class AbstractDbMapper extends EventProvider |
||
17 | { |
||
18 | /** |
||
19 | * @var Adapter |
||
20 | */ |
||
21 | protected $dbAdapter; |
||
22 | |||
23 | /** |
||
24 | * @var Adapter |
||
25 | */ |
||
26 | protected $dbSlaveAdapter; |
||
27 | |||
28 | /** |
||
29 | * @var HydratorInterface |
||
30 | */ |
||
31 | protected $hydrator; |
||
32 | |||
33 | /** |
||
34 | * @var UserEntityInterface |
||
35 | */ |
||
36 | protected $entityPrototype; |
||
37 | |||
38 | /** |
||
39 | * @var HydratingResultSet |
||
40 | */ |
||
41 | protected $resultSetPrototype; |
||
42 | |||
43 | /** |
||
44 | * @var Select |
||
45 | */ |
||
46 | protected $selectPrototype; |
||
47 | |||
48 | /** |
||
49 | * @var Sql |
||
50 | */ |
||
51 | private $sql; |
||
52 | |||
53 | /** |
||
54 | * @var Sql |
||
55 | */ |
||
56 | private $slaveSql; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | protected $tableName; |
||
62 | |||
63 | /** |
||
64 | * @var boolean |
||
65 | */ |
||
66 | private $isInitialized = false; |
||
67 | |||
68 | /** |
||
69 | * Performs some basic initialization setup and checks before running a query |
||
70 | * |
||
71 | * @throws \Exception |
||
72 | * @return null |
||
73 | */ |
||
74 | protected function initialize() |
||
91 | |||
92 | /** |
||
93 | * @param string|null $table |
||
94 | * @return Select |
||
95 | */ |
||
96 | protected function getSelect($table = null) |
||
102 | |||
103 | /** |
||
104 | * @param Select $select |
||
105 | * @param UserEntityInterface|null $entityPrototype |
||
106 | * @param HydratorInterface|null $hydrator |
||
107 | * @return HydratingResultSet |
||
108 | */ |
||
109 | protected function select(Select $select, UserEntityInterface $entityPrototype = null, HydratorInterface $hydrator = null) |
||
120 | |||
121 | /** |
||
122 | * @param UserEntityInterface $entity |
||
123 | * @param string|TableIdentifier|null $tableName |
||
124 | * @param HydratorInterface|null $hydrator |
||
125 | * @return ResultInterface |
||
126 | */ |
||
127 | protected function insert(UserEntityInterface $entity, $tableName = null, HydratorInterface $hydrator = null) |
||
138 | |||
139 | /** |
||
140 | * @param UserEntityInterface $entity |
||
141 | * @param string|array|\Closure $where |
||
142 | * @param string|TableIdentifier|null $tableName |
||
143 | * @param HydratorInterface|null $hydrator |
||
144 | * @return ResultInterface |
||
145 | */ |
||
146 | protected function update(UserEntityInterface $entity, $where, $tableName = null, HydratorInterface $hydrator = null) |
||
158 | |||
159 | /** |
||
160 | * @param string|array|\Closure $where |
||
161 | * @param string|TableIdentifier|null $tableName |
||
162 | * @return ResultInterface |
||
163 | */ |
||
164 | protected function delete($where, $tableName = null) |
||
173 | |||
174 | /** |
||
175 | * @return string |
||
176 | */ |
||
177 | protected function getTableName() |
||
181 | |||
182 | /** |
||
183 | * @return UserEntityInterface |
||
184 | */ |
||
185 | public function getEntityPrototype() |
||
189 | |||
190 | /** |
||
191 | * @param UserEntityInterface $entityPrototype |
||
192 | * @return AbstractDbMapper |
||
193 | */ |
||
194 | public function setEntityPrototype(UserEntityInterface $entityPrototype) |
||
200 | |||
201 | /** |
||
202 | * @return Adapter |
||
203 | */ |
||
204 | public function getDbAdapter() |
||
208 | |||
209 | /** |
||
210 | * @param Adapter $dbAdapter |
||
211 | * @return AbstractDbMapper |
||
212 | */ |
||
213 | public function setDbAdapter(Adapter $dbAdapter) |
||
221 | |||
222 | /** |
||
223 | * @return Adapter |
||
224 | */ |
||
225 | public function getDbSlaveAdapter() |
||
229 | |||
230 | /** |
||
231 | * @param Adapter $dbSlaveAdapter |
||
232 | * @return AbstractDbMapper |
||
233 | */ |
||
234 | public function setDbSlaveAdapter(Adapter $dbSlaveAdapter) |
||
239 | |||
240 | /** |
||
241 | * @return HydratorInterface |
||
242 | */ |
||
243 | public function getHydrator() |
||
250 | |||
251 | /** |
||
252 | * @param HydratorInterface $hydrator |
||
253 | * @return AbstractDbMapper |
||
254 | */ |
||
255 | public function setHydrator(HydratorInterface $hydrator) |
||
261 | |||
262 | /** |
||
263 | * @return Sql |
||
264 | */ |
||
265 | protected function getSql() |
||
272 | |||
273 | /** |
||
274 | * @param Sql $sql |
||
275 | * @return AbstractDbMapper |
||
276 | */ |
||
277 | protected function setSql(Sql $sql) |
||
282 | |||
283 | /** |
||
284 | * @return Sql |
||
285 | */ |
||
286 | protected function getSlaveSql() |
||
293 | |||
294 | /** |
||
295 | * @param Sql $sql |
||
296 | * @return AbstractDbMapper |
||
297 | */ |
||
298 | protected function setSlaveSql(Sql $sql) |
||
303 | |||
304 | /** |
||
305 | * Uses the hydrator to convert the entity to an array. |
||
306 | * |
||
307 | * Use this method to ensure that you're working with an array. |
||
308 | * |
||
309 | * @param UserEntityInterface $entity |
||
310 | * @param HydratorInterface|null $hydrator |
||
311 | * @return array |
||
312 | */ |
||
313 | protected function entityToArray(UserEntityInterface $entity, HydratorInterface $hydrator = null) |
||
321 | } |
||
322 |
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: