1 | <?php |
||
13 | abstract class AbstractDbMapper extends EventProvider |
||
14 | { |
||
15 | /** |
||
16 | * @var Adapter |
||
17 | */ |
||
18 | protected $dbAdapter; |
||
19 | /** |
||
20 | * @var Adapter |
||
21 | */ |
||
22 | protected $dbSlaveAdapter; |
||
23 | /** |
||
24 | * @var HydratorInterface |
||
25 | */ |
||
26 | protected $hydrator; |
||
27 | /** |
||
28 | * @var object |
||
29 | */ |
||
30 | protected $entityPrototype; |
||
31 | /** |
||
32 | * @var HydratingResultSet |
||
33 | */ |
||
34 | protected $resultSetPrototype; |
||
35 | /** |
||
36 | * @var Select |
||
37 | */ |
||
38 | protected $selectPrototype; |
||
39 | /** |
||
40 | * @var Sql |
||
41 | */ |
||
42 | private $sql; |
||
43 | /** |
||
44 | * @var Sql |
||
45 | */ |
||
46 | private $slaveSql; |
||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $tableName; |
||
51 | /** |
||
52 | * @var boolean |
||
53 | */ |
||
54 | private $isInitialized = false; |
||
55 | /** |
||
56 | * Performs some basic initialization setup and checks before running a query |
||
57 | * @throws \Exception |
||
58 | * @return null |
||
59 | */ |
||
60 | protected function initialize() |
||
76 | /** |
||
77 | * @param string|null $table |
||
78 | * @return Select |
||
79 | */ |
||
80 | protected function getSelect($table = null) |
||
85 | /** |
||
86 | * @param Select $select |
||
87 | * @param object|null $entityPrototype |
||
88 | * @param HydratorInterface|null $hydrator |
||
89 | * @return HydratingResultSet |
||
90 | */ |
||
91 | protected function select(Select $select, $entityPrototype = null, HydratorInterface $hydrator = null) |
||
100 | /** |
||
101 | * @param object|array $entity |
||
102 | * @param string|TableIdentifier|null $tableName |
||
103 | * @param HydratorInterface|null $hydrator |
||
104 | * @return ResultInterface |
||
105 | */ |
||
106 | protected function insert($entity, $tableName = null, HydratorInterface $hydrator = null) |
||
117 | /** |
||
118 | * @param object|array $entity |
||
119 | * @param string|array|\Closure $where |
||
120 | * @param string|TableIdentifier|null $tableName |
||
121 | * @param HydratorInterface|null $hydrator |
||
122 | * @return ResultInterface |
||
123 | */ |
||
124 | protected function update($entity, $where, $tableName = null, HydratorInterface $hydrator = null) |
||
136 | /** |
||
137 | * @param string|array|\Closure $where |
||
138 | * @param string|TableIdentifier|null $tableName |
||
139 | * @return ResultInterface |
||
140 | */ |
||
141 | protected function delete($where, $tableName = null) |
||
150 | /** |
||
151 | * @return string |
||
152 | */ |
||
153 | protected function getTableName() |
||
157 | /** |
||
158 | * @return object |
||
159 | */ |
||
160 | public function getEntityPrototype() |
||
164 | /** |
||
165 | * @param object $entityPrototype |
||
166 | * @return AbstractDbMapper |
||
167 | */ |
||
168 | public function setEntityPrototype($entityPrototype) |
||
174 | /** |
||
175 | * @return Adapter |
||
176 | */ |
||
177 | public function getDbAdapter() |
||
181 | /** |
||
182 | * @param Adapter $dbAdapter |
||
183 | * @return AbstractDbMapper |
||
184 | */ |
||
185 | public function setDbAdapter(Adapter $dbAdapter) |
||
193 | /** |
||
194 | * @return Adapter |
||
195 | */ |
||
196 | public function getDbSlaveAdapter() |
||
200 | /** |
||
201 | * @param Adapter $dbSlaveAdapter |
||
202 | * @return AbstractDbMapper |
||
203 | */ |
||
204 | public function setDbSlaveAdapter(Adapter $dbSlaveAdapter) |
||
209 | /** |
||
210 | * @return HydratorInterface |
||
211 | */ |
||
212 | public function getHydrator() |
||
219 | /** |
||
220 | * @param HydratorInterface $hydrator |
||
221 | * @return AbstractDbMapper |
||
222 | */ |
||
223 | public function setHydrator(HydratorInterface $hydrator) |
||
229 | /** |
||
230 | * @return Sql |
||
231 | */ |
||
232 | protected function getSql() |
||
239 | /** |
||
240 | * @param Sql $sql |
||
241 | * @return AbstractDbMapper |
||
242 | */ |
||
243 | protected function setSql(Sql $sql) |
||
248 | /** |
||
249 | * @return Sql |
||
250 | */ |
||
251 | protected function getSlaveSql() |
||
258 | /** |
||
259 | * @param Sql $sql |
||
260 | * @return AbstractDbMapper |
||
261 | */ |
||
262 | protected function setSlaveSql(Sql $sql) |
||
267 | /** |
||
268 | * Uses the hydrator to convert the entity to an array. |
||
269 | * |
||
270 | * Use this method to ensure that you're working with an array. |
||
271 | * |
||
272 | * @param object $entity |
||
273 | * @param HydratorInterface|null $hydrator |
||
274 | * @return array |
||
275 | */ |
||
276 | protected function entityToArray($entity, HydratorInterface $hydrator = null) |
||
288 | } |
||
289 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.