|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Canvas\Mapper; |
|
6
|
|
|
|
|
7
|
|
|
use AutoMapperPlus\CustomMapper\CustomMapper; |
|
8
|
|
|
use Canvas\Models\SystemModules; |
|
9
|
|
|
use ReflectionClass; |
|
10
|
|
|
|
|
11
|
|
|
// You can either extend the CustomMapper, or just implement the MapperInterface |
|
12
|
|
|
// directly. |
|
13
|
|
|
class NotificationMapper extends CustomMapper |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @param Canvas\Models\Notification $notification |
|
|
|
|
|
|
17
|
|
|
* @param Canvas\Dto\notificationDto $notificationDto |
|
|
|
|
|
|
18
|
|
|
* @return Files |
|
|
|
|
|
|
19
|
|
|
*/ |
|
20
|
|
|
public function mapToObject($notification, $notificationDto, array $context = []) |
|
21
|
|
|
{ |
|
22
|
|
|
$notificationDto->id = $notification->getId(); |
|
23
|
|
|
$notificationDto->type = $notification->type->name; |
|
24
|
|
|
$notificationDto->users_id = $notification->users_id; |
|
25
|
|
|
$notificationDto->from_users_id = $notification->from_users_id; |
|
26
|
|
|
$notificationDto->companies_id = $notification->companies_id; |
|
27
|
|
|
$notificationDto->apps_id = $notification->apps_id; |
|
28
|
|
|
$notificationDto->system_modules_id = $notification->system_modules_id; |
|
29
|
|
|
$notificationDto->notification_type_id = $notification->notification_type_id; |
|
30
|
|
|
$notificationDto->entity_id = $notification->entity_id; |
|
31
|
|
|
$notificationDto->content = $notification->content; |
|
32
|
|
|
$notificationDto->read = $notification->read; |
|
33
|
|
|
$notificationDto->created_at = $notification->created_at; |
|
34
|
|
|
$notificationDto->updated_at = $notification->updated_at; |
|
35
|
|
|
$notificationDto->from = [ |
|
36
|
|
|
'user_id' => $notification->from->getId(), |
|
37
|
|
|
'displayname' => $notification->from->displayname, |
|
38
|
|
|
'avatar' => $notification->from->photo ? $notification->from->photo->url : null, |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
|
|
$systemModule = SystemModules::getById($notification->system_modules_id); |
|
42
|
|
|
$systemModuleEntity = new $systemModule->model_name; |
|
43
|
|
|
$entity = $systemModuleEntity::findFirst($notification->entity_id); |
|
44
|
|
|
$notificationDto->entity = $entity->toArray(); |
|
45
|
|
|
$reflect = new ReflectionClass($systemModuleEntity); |
|
46
|
|
|
$notificationDto->entity['type'] = $reflect->getShortName(); |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
return $notificationDto; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths