1 | <?php |
||
24 | trait InstanceMutatorTrait |
||
25 | { |
||
26 | use ActiveRecordTrait; |
||
27 | |||
28 | /** |
||
29 | * @var ProviderInstance|null |
||
30 | */ |
||
31 | private $instance; |
||
32 | |||
33 | /** |
||
34 | * Set associated instanceId |
||
35 | * |
||
36 | * @param $id |
||
37 | * @return $this |
||
38 | */ |
||
39 | public function setInstanceId(int $id) |
||
44 | |||
45 | /** |
||
46 | * Get associated instanceId |
||
47 | * |
||
48 | * @return int|null |
||
49 | */ |
||
50 | public function getInstanceId() |
||
60 | |||
61 | /** |
||
62 | * Associate a instance |
||
63 | * |
||
64 | * @param mixed $instance |
||
65 | * @return $this |
||
66 | */ |
||
67 | public function setInstance($instance = null) |
||
81 | |||
82 | /** |
||
83 | * @return ProviderInstance|null |
||
84 | */ |
||
85 | public function getInstance() |
||
103 | |||
104 | /** |
||
105 | * @return ProviderInstance|null |
||
106 | */ |
||
107 | protected function resolveInstance() |
||
119 | |||
120 | /** |
||
121 | * @return ProviderInstance|null |
||
122 | */ |
||
123 | private function resolveInstanceFromRelation() |
||
136 | |||
137 | /** |
||
138 | * @return ProviderInstance|null |
||
139 | */ |
||
140 | private function resolveInstanceFromId() |
||
148 | |||
149 | /** |
||
150 | * @param $instance |
||
151 | * @return ProviderInstance|null |
||
152 | */ |
||
153 | protected function internalResolveInstance($instance = null) |
||
177 | |||
178 | /** |
||
179 | * Returns the associated instance record. |
||
180 | * |
||
181 | * @return ActiveQueryInterface |
||
182 | */ |
||
183 | protected function getInstanceRecord(): ActiveQueryInterface |
||
190 | } |
||
191 |