1 | <?php |
||
31 | class OrganizationType extends ActiveRecordWithId |
||
32 | { |
||
33 | use FieldLayoutAttributeTrait, |
||
34 | HandleRulesTrait { |
||
35 | resolveFieldLayout as parentResolveFieldLayout; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * The table name |
||
40 | */ |
||
41 | const TABLE_ALIAS = Organization::TABLE_ALIAS . '_types'; |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | protected $getterPriorityAttributes = ['fieldLayoutId']; |
||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | protected static function fieldLayoutType(): string |
||
55 | |||
56 | /** |
||
57 | * @inheritdoc |
||
58 | */ |
||
59 | protected function resolveFieldLayout() |
||
67 | |||
68 | |||
69 | /** |
||
70 | * @noinspection PhpDocMissingThrowsInspection |
||
71 | * |
||
72 | * @inheritdoc |
||
73 | * @return OrganizationTypeQuery |
||
74 | */ |
||
75 | public static function find() |
||
81 | |||
82 | /******************************************* |
||
83 | * EVENTS |
||
84 | *******************************************/ |
||
85 | |||
86 | /** |
||
87 | * @inheritdoc |
||
88 | * @throws Exception |
||
89 | */ |
||
90 | public function beforeSave($insert) |
||
115 | |||
116 | /** |
||
117 | * @return int |
||
118 | */ |
||
119 | protected function getDefaultFieldLayoutId(): int |
||
123 | |||
124 | /** |
||
125 | * @inheritdoc |
||
126 | * @throws Exception |
||
127 | * @throws \Throwable |
||
128 | * @throws \craft\errors\SiteNotFoundException |
||
129 | * @throws \yii\db\StaleObjectException |
||
130 | */ |
||
131 | public function afterSave($insert, $changedAttributes) |
||
170 | |||
171 | |||
172 | |||
173 | /******************************************* |
||
174 | * SITE SETTINGS |
||
175 | *******************************************/ |
||
176 | |||
177 | /** |
||
178 | * @return OrganizationTypeSiteSettings[] |
||
179 | * @throws \craft\errors\SiteNotFoundException |
||
180 | */ |
||
181 | public function getSiteSettings(): array |
||
189 | |||
190 | /** |
||
191 | * @param array $siteSettings |
||
192 | * @return $this |
||
193 | */ |
||
194 | public function setSiteSettings(array $siteSettings = []) |
||
203 | |||
204 | /** |
||
205 | * @return $this |
||
206 | * @throws \craft\errors\SiteNotFoundException |
||
207 | */ |
||
208 | protected function addPrimarySiteSettings() |
||
218 | |||
219 | /** |
||
220 | * @param int $siteId |
||
221 | * @param $site |
||
222 | * @return OrganizationTypeSiteSettings |
||
223 | */ |
||
224 | protected function resolveSiteSettings(int $siteId, $site): OrganizationTypeSiteSettings |
||
236 | |||
237 | /** |
||
238 | * @param int $siteId |
||
239 | * @param $site |
||
240 | * @return $this |
||
241 | */ |
||
242 | protected function addSiteSettings(int $siteId, $site) |
||
254 | |||
255 | |||
256 | /** |
||
257 | * @inheritdoc |
||
258 | */ |
||
259 | public function rules() |
||
294 | |||
295 | /** |
||
296 | * @return array |
||
297 | */ |
||
298 | public function attributeLabels() |
||
305 | |||
306 | /** |
||
307 | * @return ActiveQueryInterface |
||
308 | * @throws \craft\errors\SiteNotFoundException |
||
309 | */ |
||
310 | protected function getSiteSettingRecords(): ActiveQueryInterface |
||
318 | |||
319 | /** |
||
320 | * @inheritdoc |
||
321 | */ |
||
322 | public function __toString() |
||
326 | } |
||
327 |