Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
35 | public static function create(array $user, string $content, int $notificationTypeId, string $systemModule): void |
||
36 | { |
||
37 | $notification = new Notifications(); |
||
38 | $notification->users_id = $user['id']; |
||
39 | $notification->companies_id = $user['default_company']; |
||
40 | $notification->apps_id = Di::getDefault()->getApp()->getId(); |
||
41 | $notification->notification_type_id = $notificationTypeId; |
||
42 | $notification->system_module_id = SystemModules::getSystemModuleByModelName($systemModule)->id; |
||
43 | $notification->entity_id = $user['id']; |
||
44 | $notification->content = $content; |
||
45 | $notification->created_at = date('Y-m-d H:i:s'); |
||
46 | |||
47 | if (!$notification->save()) { |
||
48 | Di::getDefault()->getLog()->error((string)current($notification->getMessages())); |
||
49 | } |
||
52 |