1 | <?php |
||
20 | abstract class RelationLoader extends QueryLoader |
||
21 | { |
||
22 | use ColumnsTrait; |
||
23 | |||
24 | /** |
||
25 | * Used to create unique set of aliases for loaded relations. |
||
26 | * |
||
27 | * @var int |
||
28 | */ |
||
29 | private static $countLevels = 0; |
||
30 | |||
31 | /** |
||
32 | * Name of relation loader associated with. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $relation; |
||
37 | |||
38 | /** |
||
39 | * Default set of relation options. Child implementation might defined their of default options. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $options = [ |
||
44 | //Load method, see QueryLoader constants |
||
45 | 'method' => null, |
||
46 | |||
47 | //When true all loader columns will be minified (only for loading) |
||
48 | 'minify' => true, |
||
49 | |||
50 | //Table alias |
||
51 | 'alias' => null, |
||
52 | |||
53 | //Alias used by another relation |
||
54 | 'using' => null, |
||
55 | |||
56 | //Where conditions (if any) |
||
57 | 'where' => null, |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * @param string $class |
||
62 | * @param string $relation |
||
63 | * @param array $schema |
||
64 | * @param ORMInterface $orm |
||
65 | */ |
||
66 | public function __construct(string $class, string $relation, array $schema, ORMInterface $orm) |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | public function withContext(LoaderInterface $parent, array $options = []): LoaderInterface |
||
102 | |||
103 | /** |
||
104 | * Indicated that loaded must generate JOIN statement. |
||
105 | * |
||
106 | * @return bool |
||
107 | */ |
||
108 | public function isJoined(): bool |
||
116 | |||
117 | /** |
||
118 | * Indication that loader want to load data. |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function isLoaded(): bool |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function loadData(AbstractNode $node) |
||
158 | |||
159 | /** |
||
160 | * Configure query with conditions, joins and columns. |
||
161 | * |
||
162 | * @param SelectQuery $query |
||
163 | * @param array $references Set of OUTER_KEY values collected by parent loader. |
||
164 | * |
||
165 | * @return SelectQuery |
||
166 | */ |
||
167 | protected function configureQuery(SelectQuery $query, array $references = []): SelectQuery |
||
179 | |||
180 | /** |
||
181 | * Relation table alias. |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | protected function getAlias(): string |
||
198 | |||
199 | /** |
||
200 | * Relation columns. |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | protected function getColumns(): array |
||
208 | |||
209 | /** |
||
210 | * Get load method. |
||
211 | * |
||
212 | * @return int |
||
213 | */ |
||
214 | protected function getMethod(): int |
||
218 | |||
219 | /** |
||
220 | * Generate sql identifier using loader alias and value from relation definition. Key name to be |
||
221 | * fetched from schema. |
||
222 | * |
||
223 | * Example: |
||
224 | * $this->getKey(Record::OUTER_KEY); |
||
225 | * |
||
226 | * @param string $key |
||
227 | * |
||
228 | * @return string|null |
||
229 | */ |
||
230 | protected function localKey($key): string |
||
234 | |||
235 | /** |
||
236 | * Get parent identifier based on relation configuration key. |
||
237 | * |
||
238 | * @param $key |
||
239 | * |
||
240 | * @return string |
||
241 | */ |
||
242 | protected function parentKey($key): string |
||
246 | |||
247 | /** |
||
248 | * Ensure table alias. |
||
249 | * |
||
250 | * @param QueryLoader $parent |
||
251 | */ |
||
252 | protected function ensureAlias(QueryLoader $parent) |
||
266 | |||
267 | /** |
||
268 | * Create relation specific select query. |
||
269 | * |
||
270 | * @param array $references List of parent key values aggregates while parsing. |
||
|
|||
271 | * |
||
272 | * @return SelectQuery |
||
273 | */ |
||
274 | protected function createQuery(): SelectQuery |
||
280 | } |
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.