| Total Complexity | 10 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 94.44% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class MultiTenantRecord extends ActiveRecord |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | *@inheritdoc |
||
| 13 | */ |
||
| 14 | 1 | public function beforeSave($insert) |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritdoc} |
||
| 32 | */ |
||
| 33 | 3 | public static function find() |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | 1 | protected function resolveFields(array $fields, array $expand) |
|
| 42 | { |
||
| 43 | 1 | $fields = parent::resolveFields($fields, $expand); |
|
| 44 | 1 | unset($fields[TenantInterface::ATTRIBUTE_NAME]); |
|
| 45 | 1 | return $fields; |
|
| 46 | } |
||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | /** |
||
| 51 | * This method is invoked before assign the attribute tenant id |
||
| 52 | * You may override this method to do preliminary checks before apply tenant id. |
||
| 53 | * @return boolean whether the tenant id should be assigned. Defaults to true. |
||
| 54 | */ |
||
| 55 | 1 | protected function beforeApplyTenant() |
|
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * This method is invoked after assign the attribute tenant id |
||
| 62 | * You may override this method to do postprocessing after apply tenant id. |
||
| 63 | */ |
||
| 64 | 1 | protected function afterApplyTenant() |
|
| 69 |