|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Canvas\Mapper; |
|
6
|
|
|
|
|
7
|
|
|
use AutoMapperPlus\CustomMapper\CustomMapper; |
|
|
|
|
|
|
8
|
|
|
use Canvas\Models\Subscription; |
|
9
|
|
|
|
|
10
|
|
|
// You can either extend the CustomMapper, or just implement the MapperInterface |
|
11
|
|
|
// directly. |
|
12
|
|
|
class CompaniesGroupsMapper extends CustomMapper |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @param Baka\Database\CustomFilters\CustomFilters $filter |
|
|
|
|
|
|
16
|
|
|
* @param \Canvas\Dto\CustomFilter $filterSchema |
|
17
|
|
|
* |
|
18
|
|
|
* @return ListSchema |
|
19
|
|
|
*/ |
|
20
|
|
|
public function mapToObject($companiesGroup, $companiesGroupDto, array $context = []) |
|
21
|
|
|
{ |
|
22
|
|
|
$companiesGroupDto->id = $companiesGroup->getId(); |
|
23
|
|
|
$companiesGroupDto->name = $companiesGroup->name; |
|
24
|
|
|
$companiesGroupDto->users_id = $companiesGroup->users_id; |
|
25
|
|
|
$companiesGroupDto->apps_id = $companiesGroup->apps_id; |
|
26
|
|
|
$companyArray = []; |
|
27
|
|
|
/** |
|
28
|
|
|
* Let's find all companies and their apps plans. |
|
29
|
|
|
*/ |
|
30
|
|
|
foreach ($companiesGroup->getCompanies() as $company) { |
|
31
|
|
|
$subscription = Subscription::findFirst([ |
|
32
|
|
|
'conditions' => 'user_id = ?0 and companies_id = ?1 and is_deleted = 0', |
|
33
|
|
|
'bind' => [$companiesGroup->users_id, $company->id] |
|
34
|
|
|
]); |
|
35
|
|
|
|
|
36
|
|
|
foreach ($company as $key => $value) { |
|
37
|
|
|
$companyArray[$key] = $value; |
|
38
|
|
|
$companyArray['app_plan'] = $subscription->getAppPlan(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
$companiesGroupDto->companies[] = $companyArray; |
|
42
|
|
|
} |
|
43
|
|
|
$companiesGroupDto->created_at = $companiesGroup->created_at; |
|
44
|
|
|
$companiesGroupDto->updated_at = $companiesGroup->updated_at; |
|
45
|
|
|
$companiesGroupDto->is_deleted = $companiesGroup->is_deleted; |
|
46
|
|
|
|
|
47
|
|
|
return $companiesGroupDto; |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
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