1 | <?php |
||
22 | class RootLoader extends AbstractLoader |
||
23 | { |
||
24 | use ColumnsTrait; |
||
25 | |||
26 | /** |
||
27 | * Root loader always define primary SelectQuery. |
||
28 | * |
||
29 | * @var SelectQuery |
||
30 | */ |
||
31 | private $query; |
||
32 | |||
33 | /** |
||
34 | * @param string $class |
||
35 | * @param array $schema Record schema for root loader. |
||
36 | * @param ORMInterface $orm |
||
37 | */ |
||
38 | public function __construct(string $class, array $schema, ORMInterface $orm) |
||
53 | |||
54 | /** |
||
55 | * Return initial loader query (attention, mutable instance). |
||
56 | * |
||
57 | * @return SelectQuery |
||
58 | */ |
||
59 | public function initialQuery(): SelectQuery |
||
63 | |||
64 | /** |
||
65 | * Return build version of query. |
||
66 | * |
||
67 | * @return SelectQuery |
||
68 | */ |
||
69 | public function compileQuery(): SelectQuery |
||
73 | |||
74 | /** |
||
75 | * Get primary key column if possible (aliased). Null when key is missing or non singular. |
||
76 | * |
||
77 | * @return string|null |
||
78 | */ |
||
79 | public function primaryKey() |
||
88 | |||
89 | /** |
||
90 | * @param SelectQuery $query |
||
91 | * |
||
92 | * @return SelectQuery |
||
93 | */ |
||
94 | protected function configureQuery(SelectQuery $query): SelectQuery |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | public function loadData(AbstractNode $node) |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function initNode(): AbstractNode |
||
137 | |||
138 | /** |
||
139 | * Clone with initial query. |
||
140 | */ |
||
141 | public function __clone() |
||
146 | |||
147 | /** |
||
148 | * We are using model role as alias. |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | protected function getAlias(): string |
||
156 | |||
157 | /** |
||
158 | * Relation columns. |
||
159 | * |
||
160 | * @return array |
||
161 | */ |
||
162 | protected function getColumns(): array |
||
166 | } |