1 | <?php |
||
26 | trait TargetAttributeTrait |
||
27 | { |
||
28 | use ActiveRecordTrait; |
||
29 | |||
30 | /** |
||
31 | * @var Element|ElementInterface|null |
||
32 | */ |
||
33 | private $target; |
||
34 | |||
35 | /** |
||
36 | * @param string $attribute |
||
37 | * @return Element|ElementInterface|null |
||
38 | */ |
||
39 | abstract protected function resolveElementFromIdAttribute(string $attribute); |
||
40 | |||
41 | /** |
||
42 | * @param mixed $element |
||
43 | * @return Element|ElementInterface|null |
||
44 | */ |
||
45 | abstract protected function resolveElement($element = null); |
||
46 | |||
47 | /** |
||
48 | * @return array |
||
49 | */ |
||
50 | protected function targetRules(): array |
||
72 | |||
73 | /** |
||
74 | * @inheritdoc |
||
75 | */ |
||
76 | public function targetAttributeLabels(): array |
||
82 | |||
83 | /** |
||
84 | * @param int|null $id |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function setTargetId(int $id = null) |
||
96 | |||
97 | /** |
||
98 | * Get associated targetId |
||
99 | * |
||
100 | * @return int|null |
||
101 | */ |
||
102 | public function getTargetId() |
||
110 | |||
111 | /** |
||
112 | * @param mixed $target |
||
113 | * @return $this |
||
114 | */ |
||
115 | public function setTarget($target = null) |
||
127 | |||
128 | /** |
||
129 | * @return Element|ElementInterface|null |
||
130 | */ |
||
131 | public function getTarget() |
||
147 | } |
||
148 |