|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Canvas\Mapper; |
|
6
|
|
|
|
|
7
|
|
|
use AutoMapperPlus\CustomMapper\CustomMapper; |
|
|
|
|
|
|
8
|
|
|
use Canvas\Models\FileSystem; |
|
9
|
|
|
use Canvas\Dto\Files; |
|
10
|
|
|
use Canvas\Models\FileSystemEntities; |
|
11
|
|
|
|
|
12
|
|
|
// You can either extend the CustomMapper, or just implement the MapperInterface |
|
13
|
|
|
// directly. |
|
14
|
|
|
class FileMapper extends CustomMapper |
|
15
|
|
|
{ |
|
16
|
|
|
public $systemModuleId; |
|
17
|
|
|
public $entityId; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @param Canvas\Models\FileSystem $file |
|
|
|
|
|
|
21
|
|
|
* @param Canvas\Dto\Files $fileDto |
|
|
|
|
|
|
22
|
|
|
* @return Files |
|
23
|
|
|
*/ |
|
24
|
|
|
public function mapToObject($file, $fileDto) |
|
25
|
|
|
{ |
|
26
|
|
|
$fieledName = FileSystemEntities::findFirst([ |
|
27
|
|
|
'conditions' => 'system_modules_id = ?0 AND entity_id = ?1 AND filesystem_id = ?2', |
|
28
|
|
|
'bind' => [$this->systemModuleId, $this->entityId , $file->getId()] |
|
29
|
|
|
]); |
|
30
|
|
|
|
|
31
|
|
|
$fileDto->id = $file->getId(); |
|
32
|
|
|
$fileDto->companies_id = $file->companies_id; |
|
33
|
|
|
$fileDto->apps_id = $file->apps_id; |
|
34
|
|
|
$fileDto->users_id = $file->users_id; |
|
35
|
|
|
$fileDto->system_modules_id = $this->systemModuleId; |
|
36
|
|
|
$fileDto->entity_id = $this->entityId; |
|
37
|
|
|
$fileDto->name = $file->name; |
|
38
|
|
|
$fileDto->field_name = $fieledName ? $fieledName->field_name : null; |
|
39
|
|
|
$fileDto->path = $file->path; |
|
40
|
|
|
$fileDto->url = $file->url; |
|
41
|
|
|
$fileDto->size = $file->size; |
|
42
|
|
|
$fileDto->file_type = $file->file_type; |
|
43
|
|
|
$fileDto->created_at = $file->created_at; |
|
44
|
|
|
$fileDto->updated_at = $file->updated_at; |
|
45
|
|
|
$fileDto->is_deleted = $file->is_deleted; |
|
46
|
|
|
$fileDto->attributes = $file->getAllSettings(); |
|
47
|
|
|
|
|
48
|
|
|
return $fileDto; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
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