1 | <?php |
||
21 | class DatabaseDriver implements DriverInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var \Pimple\Container |
||
25 | */ |
||
26 | private $app; |
||
27 | |||
28 | /** |
||
29 | * @param \Pimple\Container $app |
||
30 | */ |
||
31 | public function __construct(Container $app = null) |
||
35 | |||
36 | public function createModel(Model $model, array $parameters) |
||
51 | |||
52 | public function getCreatedID(Model $model, $propertyName) |
||
53 | { |
||
54 | try { |
||
55 | $id = $this->app['db']->getPDO()->lastInsertId(); |
||
56 | } catch (PDOException $original) { |
||
57 | $e = new DriverException('An error occurred in the database driver when getting the ID of the new '.$model::modelName()); |
||
58 | $e->setException($original); |
||
59 | throw $e; |
||
60 | } |
||
61 | |||
62 | return Model::cast($model::getProperty($propertyName)['type'], $id); |
||
63 | } |
||
64 | |||
65 | public function updateModel(Model $model, array $parameters) |
||
85 | |||
86 | public function deleteModel(Model $model) |
||
100 | |||
101 | public function queryModels(Query $query) |
||
144 | |||
145 | public function totalRecords(Query $query) |
||
161 | |||
162 | /** |
||
163 | * Generates the tablename for the model. |
||
164 | * |
||
165 | * @param string|Model $model |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getTablename($model) |
||
175 | |||
176 | /** |
||
177 | * Marshals a value to storage. |
||
178 | * |
||
179 | * @param mixed $value |
||
180 | * |
||
181 | * @return mixed serialized value |
||
182 | */ |
||
183 | public function serializeValue($value) |
||
192 | |||
193 | /** |
||
194 | * Serializes an array of values. |
||
195 | * |
||
196 | * @param array $values |
||
197 | * |
||
198 | * @return array |
||
199 | */ |
||
200 | private function serialize(array $values) |
||
208 | |||
209 | /** |
||
210 | * Returns a prefixed select statement. |
||
211 | * |
||
212 | * @param string $columns |
||
213 | * @param string $tablename |
||
214 | * |
||
215 | * @return string |
||
216 | */ |
||
217 | private function prefixSelect($columns, $tablename) |
||
226 | |||
227 | /** |
||
228 | * Returns a prefixed where statement. |
||
229 | * |
||
230 | * @param string $columns |
||
|
|||
231 | * @param string $tablename |
||
232 | * |
||
233 | * @return string |
||
234 | */ |
||
235 | private function prefixWhere(array $where, $tablename) |
||
254 | |||
255 | /** |
||
256 | * Returns a prefixed sort statement. |
||
257 | * |
||
258 | * @param string $columns |
||
259 | * @param string $tablename |
||
260 | * |
||
261 | * @return string |
||
262 | */ |
||
263 | private function prefixSort(array $sort, $tablename) |
||
271 | |||
272 | /** |
||
273 | * Prefix columns with tablename that contains only |
||
274 | * alphanumeric/underscores/*. |
||
275 | * |
||
276 | * @param string $column |
||
277 | * @param string $tablename |
||
278 | * |
||
279 | * @return string prefixed column |
||
280 | */ |
||
281 | private function prefixColumn($column, $tablename) |
||
289 | } |
||
290 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.