1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ubiquity\orm\core\prepared; |
4
|
|
|
|
5
|
|
|
use Ubiquity\orm\parser\ConditionParser; |
6
|
|
|
use Ubiquity\orm\DAO; |
7
|
|
|
use Ubiquity\orm\OrmUtils; |
8
|
|
|
use Ubiquity\db\Database; |
9
|
|
|
use Ubiquity\db\SqlUtils; |
10
|
|
|
|
11
|
|
|
abstract class DAOPreparedQuery { |
12
|
|
|
protected $databaseOffset; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* |
16
|
|
|
* @var ConditionParser |
17
|
|
|
*/ |
18
|
|
|
protected $conditionParser; |
19
|
|
|
protected $included; |
20
|
|
|
protected $hasIncluded; |
21
|
|
|
protected $useCache; |
22
|
|
|
protected $className; |
23
|
|
|
protected $tableName; |
24
|
|
|
protected $invertedJoinColumns = null; |
25
|
|
|
protected $oneToManyFields = null; |
26
|
|
|
protected $manyToManyFields = null; |
27
|
|
|
protected $transformers; |
28
|
|
|
protected $propsKeys; |
29
|
|
|
protected $accessors; |
30
|
|
|
protected $fieldList; |
31
|
|
|
protected $firstPropKey; |
32
|
|
|
protected $condition; |
33
|
|
|
/** |
34
|
|
|
* |
35
|
|
|
* @var Database |
36
|
|
|
*/ |
37
|
|
|
protected $db; |
38
|
|
|
|
39
|
|
|
public function __construct($className, $condition = null, $included = false) { |
40
|
|
|
$this->className = $className; |
41
|
|
|
$this->included = $included; |
42
|
|
|
$this->condition = $condition; |
43
|
|
|
$this->conditionParser = new ConditionParser ( $condition ); |
44
|
|
|
$this->prepare (); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function getFirstPropKey() { |
48
|
|
|
return $this->firstPropKey; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* |
53
|
|
|
* @return \Ubiquity\db\Database |
54
|
|
|
*/ |
55
|
|
|
public function getDb() { |
56
|
|
|
return $this->db; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* |
61
|
|
|
* @return mixed |
62
|
|
|
*/ |
63
|
|
|
public function getDatabaseOffset() { |
64
|
|
|
return $this->databaseOffset; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* |
69
|
|
|
* @return \Ubiquity\orm\parser\ConditionParser |
70
|
|
|
*/ |
71
|
|
|
public function getConditionParser() { |
72
|
|
|
return $this->conditionParser; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* |
77
|
|
|
* @return mixed |
78
|
|
|
*/ |
79
|
|
|
public function getIncluded() { |
80
|
|
|
return $this->included; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* |
85
|
|
|
* @return boolean |
86
|
|
|
*/ |
87
|
|
|
public function getHasIncluded() { |
88
|
|
|
return $this->hasIncluded; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* |
93
|
|
|
* @return mixed |
94
|
|
|
*/ |
95
|
|
|
public function getUseCache() { |
96
|
|
|
return $this->useCache; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* |
101
|
|
|
* @return mixed |
102
|
|
|
*/ |
103
|
|
|
public function getClassName() { |
104
|
|
|
return $this->className; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* |
109
|
|
|
* @return mixed |
110
|
|
|
*/ |
111
|
|
|
public function getTableName() { |
112
|
|
|
return $this->tableName; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* |
117
|
|
|
* @return mixed |
118
|
|
|
*/ |
119
|
|
|
public function getInvertedJoinColumns() { |
120
|
|
|
return $this->invertedJoinColumns; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* |
125
|
|
|
* @return mixed |
126
|
|
|
*/ |
127
|
|
|
public function getOneToManyFields() { |
128
|
|
|
return $this->oneToManyFields; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* |
133
|
|
|
* @return mixed |
134
|
|
|
*/ |
135
|
|
|
public function getManyToManyFields() { |
136
|
|
|
return $this->manyToManyFields; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function getTransformers() { |
140
|
|
|
return $this->transformers; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function getPropsKeys() { |
144
|
|
|
return $this->propsKeys; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* |
149
|
|
|
* @return mixed |
150
|
|
|
*/ |
151
|
|
|
public function getAccessors() { |
152
|
|
|
return $this->accessors; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
public function getFieldList() { |
156
|
|
|
return $this->fieldList; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
protected function prepare() { |
160
|
|
|
$this->db = DAO::getDb ( $this->className ); |
161
|
|
|
$this->included = DAO::_getIncludedForStep ( $this->included ); |
162
|
|
|
|
163
|
|
|
$metaDatas = OrmUtils::getModelMetadata ( $this->className ); |
164
|
|
|
$this->tableName = $metaDatas ['#tableName']; |
165
|
|
|
$this->hasIncluded = $this->included || (\is_array ( $this->included ) && \sizeof ( $this->included ) > 0); |
166
|
|
|
if ($this->hasIncluded) { |
167
|
|
|
self::_initRelationFields ( $this->included, $metaDatas, $this->invertedJoinColumns, $this->oneToManyFields, $this->manyToManyFields ); |
|
|
|
|
168
|
|
|
} |
169
|
|
|
$this->transformers = $metaDatas ['#transformers'] [DAO::$transformerOp] ?? [ ]; |
170
|
|
|
$this->fieldList = DAO::_getFieldList ( $this->tableName, $metaDatas ); |
171
|
|
|
$this->propsKeys = OrmUtils::getPropKeys ( $this->className ); |
172
|
|
|
$this->accessors = $metaDatas ['#accessors']; |
173
|
|
|
$this->firstPropKey = OrmUtils::getFirstPropKey ( $this->className ); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
abstract public function execute($params = [], $useCache = false); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.