|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Canvas\Mapper; |
|
6
|
|
|
|
|
7
|
|
|
use AutoMapperPlus\CustomMapper\CustomMapper; |
|
|
|
|
|
|
8
|
|
|
use function Canvas\Core\isJson; |
|
9
|
|
|
use Phalcon\Mvc\Model\Resultset; |
|
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class CustomFieldsMapper extends CustomMapper |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @param Canvas\Models\FileSystem $file |
|
|
|
|
|
|
15
|
|
|
* @param Canvas\Dto\Files $fileDto |
|
|
|
|
|
|
16
|
|
|
* |
|
17
|
|
|
* @return Files |
|
|
|
|
|
|
18
|
|
|
*/ |
|
19
|
|
|
public function mapToObject($customField, $customFieldDto, array $context = []) |
|
20
|
|
|
{ |
|
21
|
|
|
$customFieldDto->id = $customField->getId(); |
|
22
|
|
|
$customFieldDto->apps_id = $customField->apps_id; |
|
23
|
|
|
$customFieldDto->users_id = $customField->users_id; |
|
24
|
|
|
$customFieldDto->companies_id = $customField->companies_id; |
|
25
|
|
|
$customFieldDto->name = $customField->name; |
|
26
|
|
|
$customFieldDto->label = $customField->label; |
|
27
|
|
|
$customFieldDto->custom_fields_modules_id = $customField->custom_fields_modules_id; |
|
28
|
|
|
$customFieldDto->fields_type_id = $customField->fields_type_id; |
|
29
|
|
|
|
|
30
|
|
|
$customFieldDto->attributes = !empty($customField->attributes) && isJson($customField->attributes) ? json_decode($customField->attributes) : null; |
|
31
|
|
|
$customFieldDto->values = $customField->values ? $this->getValues($customField->values) : null; |
|
32
|
|
|
$customFieldDto->type = $customField->type ? $customField->type->toArray() : null; |
|
33
|
|
|
|
|
34
|
|
|
$customFieldDto->created_at = $customField->created_at; |
|
35
|
|
|
$customFieldDto->updated_at = $customField->updated_at; |
|
36
|
|
|
$customFieldDto->is_deleted = $customField->is_deleted; |
|
37
|
|
|
|
|
38
|
|
|
return $customFieldDto; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Format the value array of a custom field. |
|
43
|
|
|
* |
|
44
|
|
|
* @param array $values |
|
45
|
|
|
* |
|
46
|
|
|
* @return array |
|
47
|
|
|
*/ |
|
48
|
|
|
private function getValues(Resultset $values) : array |
|
49
|
|
|
{ |
|
50
|
|
|
$newValue = []; |
|
51
|
|
|
foreach ($values as $value) { |
|
52
|
|
|
$newValue[] = [ |
|
53
|
|
|
'label' => $value->label, |
|
54
|
|
|
'value' => $value->value |
|
55
|
|
|
]; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return $newValue; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
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