Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2.003 |
Changes | 0 |
1 | <?php |
||
29 | 3 | public function saveUsersAssociatedModels(string $model): void |
|
30 | { |
||
31 | 3 | $class = '\Gewaer\Models\UsersAssociated' . ucfirst($model); |
|
32 | 3 | $usersAssociatedModel = new $class(); |
|
33 | 3 | $usersAssociatedModel->users_id = $this->user->getId(); |
|
34 | 3 | $usersAssociatedModel->companies_id = $this->getId(); |
|
35 | 3 | $usersAssociatedModel->apps_id = $this->di->getApp()->getId(); |
|
36 | 3 | $usersAssociatedModel->identify_id = $this->user->getId(); |
|
37 | 3 | $usersAssociatedModel->user_active = 1; |
|
38 | 3 | $usersAssociatedModel->user_role = 'admin'; |
|
39 | |||
40 | 3 | if (!$usersAssociatedModel->save()) { |
|
41 | throw new Exception((string)current($usersAssociatedModel->getMessages())); |
||
42 | } |
||
45 |