1 | <?php |
||
9 | abstract class DriverAdapter |
||
10 | { |
||
11 | |||
12 | protected $data; |
||
13 | private $insertQuery; |
||
14 | private $updateQuery; |
||
15 | private $modelInstance; |
||
16 | protected $queryEngine; |
||
17 | private $driver; |
||
18 | |||
19 | 36 | public function setContext(ORMContext $context) |
|
20 | { |
||
21 | 36 | $this->driver = $context->getDbContext()->getDriver(); |
|
22 | 36 | } |
|
23 | |||
24 | public function setData($data) |
||
25 | { |
||
26 | $this->data = $data; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Convert datatypes from the database system's native type to a generic type |
||
31 | * supported by nibii. |
||
32 | * |
||
33 | * @param string $nativeType The native datatype |
||
34 | * @return string The generic datatype for use in nibii. |
||
35 | */ |
||
36 | abstract public function mapDataTypes($nativeType); |
||
37 | |||
38 | /** |
||
39 | * |
||
40 | * |
||
41 | * @param QueryParameters $parameters |
||
42 | * @return type |
||
43 | */ |
||
44 | 24 | public function select($parameters) |
|
57 | |||
58 | /** |
||
59 | * @param QueryParameters $parameters |
||
60 | */ |
||
61 | public function count($parameters) |
||
66 | |||
67 | 4 | private function initInsert() |
|
71 | |||
72 | 2 | private function initUpdate() |
|
76 | |||
77 | 4 | public function insert($record) |
|
84 | |||
85 | 2 | public function update($record) |
|
92 | |||
93 | /** |
||
94 | * @param QueryParameters $parameters |
||
95 | */ |
||
96 | 6 | public function bulkUpdate($data, $parameters) |
|
102 | |||
103 | /** |
||
104 | * @param QueryParameters $parameters |
||
105 | */ |
||
106 | 2 | public function delete($parameters) |
|
112 | |||
113 | public function describe($model, $relationships) |
||
121 | |||
122 | /** |
||
123 | * |
||
124 | * @return \ntentan\nibii\QueryEngine |
||
125 | */ |
||
126 | 32 | private function getQueryEngine() |
|
134 | |||
135 | /** |
||
136 | * @param RecordWrapper $model |
||
137 | */ |
||
138 | 36 | public function setModel($model) |
|
142 | |||
143 | public function getDriver() |
||
147 | |||
148 | } |
||
149 |
This check looks at variables that 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.