1 | <?php |
||
32 | class ProviderInstance extends ActiveRecordWithId |
||
33 | { |
||
34 | use traits\ProviderAttribute, |
||
35 | traits\RelatedEnvironmentsAttribute; |
||
36 | |||
37 | /** |
||
38 | * The table alias |
||
39 | */ |
||
40 | const TABLE_ALIAS = 'patron_provider_instances'; |
||
41 | |||
42 | /** |
||
43 | * The length of the identifier |
||
44 | */ |
||
45 | const CLIENT_ID_LENGTH = 100; |
||
46 | |||
47 | /** |
||
48 | * The length of the secret |
||
49 | */ |
||
50 | const CLIENT_SECRET_LENGTH = 255; |
||
51 | |||
52 | /** |
||
53 | * @var SettingsInterface |
||
54 | */ |
||
55 | private $providerSettings; |
||
56 | |||
57 | /** |
||
58 | * @inheritdoc |
||
59 | */ |
||
60 | protected $getterPriorityAttributes = [ |
||
61 | 'providerId' |
||
62 | ]; |
||
63 | |||
64 | /** |
||
65 | * @inheritdoc |
||
66 | * @return ProviderInstanceActiveQuery |
||
67 | * @throws \yii\base\InvalidConfigException |
||
68 | */ |
||
69 | public static function find() |
||
74 | |||
75 | /** |
||
76 | * @inheritdoc |
||
77 | */ |
||
78 | public function rules() |
||
125 | |||
126 | |||
127 | /******************************************* |
||
128 | * EVENTS |
||
129 | *******************************************/ |
||
130 | |||
131 | /** |
||
132 | * @inheritdoc |
||
133 | */ |
||
134 | public function afterFind() |
||
142 | |||
143 | /** |
||
144 | * @inheritdoc |
||
145 | */ |
||
146 | public function beforeSave($insert) |
||
158 | |||
159 | /** |
||
160 | * @inheritdoc |
||
161 | * @throws \Throwable |
||
162 | */ |
||
163 | public function afterSave($insert, $changedAttributes) |
||
171 | |||
172 | |||
173 | /******************************************* |
||
174 | * UPDATE / INSERT |
||
175 | *******************************************/ |
||
176 | |||
177 | /** |
||
178 | * @inheritdoc |
||
179 | * @throws \Throwable |
||
180 | */ |
||
181 | protected function insertInternal($attributes = null) |
||
189 | |||
190 | /** |
||
191 | * @inheritdoc |
||
192 | * @throws \Throwable |
||
193 | */ |
||
194 | protected function updateInternal($attributes = null) |
||
202 | |||
203 | |||
204 | /******************************************* |
||
205 | * ENVIRONMENTS |
||
206 | *******************************************/ |
||
207 | |||
208 | /** |
||
209 | * @inheritdoc |
||
210 | */ |
||
211 | protected static function environmentRecordClass(): string |
||
215 | |||
216 | /** |
||
217 | * @inheritdoc |
||
218 | */ |
||
219 | protected function prepareEnvironmentRecordConfig(array $config = []): array |
||
224 | |||
225 | /** |
||
226 | * @inheritdoc |
||
227 | */ |
||
228 | protected function environmentRelationshipQuery(): ActiveQueryInterface |
||
235 | |||
236 | /** |
||
237 | * @return string |
||
238 | * @throws \yii\base\InvalidConfigException |
||
239 | */ |
||
240 | public function getHtml(): string |
||
244 | |||
245 | /** |
||
246 | * @return SettingsInterface |
||
247 | * @throws \yii\base\InvalidConfigException |
||
248 | */ |
||
249 | public function getProviderSettings(): SettingsInterface |
||
260 | } |
||
261 |