| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0185 |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | 3 | private function addTenantCondition() |
|
| 49 | { |
||
| 50 | 3 | $identity = Yii::$app->user->identity; |
|
| 51 | 3 | if ($identity instanceof TenantInterface) { |
|
| 52 | 3 | list(,$alias) = $this->getTableNameAndAlias(); |
|
| 53 | 3 | $this->andOnCondition(["{$alias}.tenant_id" => $identity->getTenantId()]); |
|
| 54 | } else { |
||
| 55 | throw new NotSupportedException("Identity does not implements TenantInteface"); |
||
| 56 | } |
||
| 58 | } |