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