1 | <?php |
||
29 | class Association extends ActiveRecord |
||
30 | { |
||
31 | use SourceAttributeTrait, |
||
32 | TargetAttributeTrait, |
||
33 | SourceSiteAttributeTrait, |
||
34 | FieldAttributeTrait, |
||
35 | SortableTrait; |
||
36 | |||
37 | /** |
||
38 | * @inheritdoc |
||
39 | */ |
||
40 | const TABLE_ALIAS = 'relations'; |
||
41 | |||
42 | /** |
||
43 | * @inheritdoc |
||
44 | */ |
||
45 | protected $getterPriorityAttributes = ['fieldId', 'siteId', 'sourceSiteId', 'sourceId', 'targetId']; |
||
46 | |||
47 | /** |
||
48 | * @noinspection PhpDocMissingThrowsInspection |
||
49 | * @return AssociationQuery |
||
50 | */ |
||
51 | public static function find(): AssociationQuery |
||
57 | |||
58 | |||
59 | /******************************************* |
||
60 | * RULES |
||
61 | *******************************************/ |
||
62 | |||
63 | /** |
||
64 | * @return array |
||
65 | */ |
||
66 | public function rules(): array |
||
96 | |||
97 | /** |
||
98 | * @return array |
||
99 | */ |
||
100 | public function attributeLabels() |
||
108 | |||
109 | /** |
||
110 | * @inheritdoc |
||
111 | * |
||
112 | * @throws FieldNotFoundException |
||
113 | */ |
||
114 | public function beforeSave($insert) |
||
128 | |||
129 | /** |
||
130 | * @inheritdoc |
||
131 | * |
||
132 | * @throws FieldNotFoundException |
||
133 | * @throws \yii\db\Exception |
||
134 | */ |
||
135 | public function afterSave($insert, $changedAttributes) |
||
150 | |||
151 | /** |
||
152 | * @inheritdoc |
||
153 | * |
||
154 | * @throws FieldNotFoundException |
||
155 | * @throws \yii\db\Exception |
||
156 | */ |
||
157 | public function afterDelete() |
||
172 | |||
173 | /** |
||
174 | * @return SortableInterface |
||
175 | * @throws FieldNotFoundException |
||
176 | */ |
||
177 | protected function getSortableField(): SortableInterface |
||
190 | |||
191 | |||
192 | /******************************************* |
||
193 | * RESOLVERS |
||
194 | *******************************************/ |
||
195 | |||
196 | /** |
||
197 | * @param string $attribute |
||
198 | * @return Element|ElementInterface|null |
||
199 | */ |
||
200 | protected function resolveElementFromIdAttribute(string $attribute) |
||
208 | |||
209 | /** |
||
210 | * @param mixed $element |
||
211 | * @return Element|ElementInterface|null |
||
212 | */ |
||
213 | protected function resolveElement($element = null) |
||
229 | } |
||
230 |