1 | <?php |
||
27 | trait Accessor |
||
28 | { |
||
29 | use QueryAccessor { |
||
30 | queryOne as parentQueryOne; |
||
31 | queryAll as parentQueryAll; |
||
32 | } |
||
33 | |||
34 | /******************************************* |
||
35 | * OBJECT CLASSES |
||
36 | *******************************************/ |
||
37 | |||
38 | /** |
||
39 | * @return string|null |
||
40 | */ |
||
41 | abstract public static function objectClass(); |
||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | public static function objectClassInstance(): string |
||
50 | |||
51 | /******************************************* |
||
52 | * CREATE |
||
53 | *******************************************/ |
||
54 | |||
55 | /** |
||
56 | * @param array $config |
||
57 | * @return BaseObject |
||
58 | * @throws \yii\base\InvalidConfigException |
||
59 | */ |
||
60 | public function create($config = []) |
||
71 | |||
72 | /** |
||
73 | * @param array $config |
||
74 | * @return array |
||
75 | */ |
||
76 | protected function prepareConfig($config = []): array |
||
90 | |||
91 | /** |
||
92 | * @param Record $record |
||
93 | * @return array |
||
94 | */ |
||
95 | protected function prepareConfigFromRecord(Record $record): array |
||
102 | |||
103 | /** |
||
104 | * @param Record $record |
||
105 | * @return BaseObject |
||
106 | * @throws \yii\base\InvalidConfigException |
||
107 | */ |
||
108 | protected function createFromRecord(Record $record) |
||
117 | |||
118 | |||
119 | /******************************************* |
||
120 | * FIND / GET |
||
121 | *******************************************/ |
||
122 | |||
123 | /** |
||
124 | * @inheritdoc |
||
125 | */ |
||
126 | public function find($identifier) |
||
135 | |||
136 | /******************************************* |
||
137 | * CACHE |
||
138 | *******************************************/ |
||
139 | |||
140 | /** |
||
141 | * @inheritdoc |
||
142 | * @throws \yii\base\InvalidConfigException |
||
143 | */ |
||
144 | protected function queryOne(QueryInterface $query) |
||
145 | { |
||
146 | return $this->createFromQueryResult( |
||
147 | $this->parentQueryOne($query) |
||
|
|||
148 | ); |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * @inheritdoc |
||
153 | * @throws \yii\base\InvalidConfigException |
||
154 | */ |
||
155 | protected function queryAll(QueryInterface $query) |
||
156 | { |
||
157 | return $this->createAllFromQueryResults( |
||
158 | $this->parentQueryAll($query) |
||
159 | ); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * @param $result |
||
164 | * @return null|BaseObject |
||
165 | */ |
||
166 | protected function createFromQueryResult($result) |
||
174 | |||
175 | /** |
||
176 | * @param array $results |
||
177 | * @return array |
||
178 | * @throws \yii\base\InvalidConfigException |
||
179 | */ |
||
180 | protected function createAllFromQueryResults(array $results): array |
||
189 | |||
190 | /******************************************* |
||
191 | * EXCEPTIONS |
||
192 | *******************************************/ |
||
193 | |||
194 | /** |
||
195 | * @throws ObjectNotFoundException |
||
196 | */ |
||
197 | protected function notFoundException() |
||
205 | } |
||
206 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.