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