1 | <?php |
||
2 | |||
3 | namespace ControleOnline\Service; |
||
4 | |||
5 | use Doctrine\ORM\EntityManagerInterface; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | use ControleOnline\Entity\Contract; |
||
8 | use ControleOnline\Entity\File; |
||
0 ignored issues
–
show
The type
ControleOnline\Entity\File was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
9 | use ControleOnline\Entity\Status; |
||
0 ignored issues
–
show
The type
ControleOnline\Entity\Status was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
10 | |||
11 | class ContractService |
||
12 | { |
||
13 | |||
14 | public function __construct( |
||
15 | private EntityManagerInterface $manager, |
||
16 | private PdfService $pdf, |
||
0 ignored issues
–
show
The type
ControleOnline\Service\PdfService was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
17 | private ModelService $modelService, |
||
0 ignored issues
–
show
The type
ControleOnline\Service\ModelService was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
18 | private StatusService $statusService |
||
0 ignored issues
–
show
The type
ControleOnline\Service\StatusService was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
19 | ) {} |
||
20 | |||
21 | public function genetateFromModel(Contract $data) |
||
22 | { |
||
23 | $file = $data->getContractFile(); |
||
24 | if (!$file) |
||
25 | $file = new File(); |
||
26 | |||
27 | $file->setFileType('text'); |
||
28 | $file->setExtension('html'); |
||
29 | $file->setContent($this->modelService->genetateFromModel($data)); |
||
30 | $file->setFileName($data->getContractModel()->getModel()); |
||
31 | $file->setPeople($data->getBeneficiary()); |
||
32 | |||
33 | $this->manager->persist($file); |
||
34 | |||
35 | $data->setContractFile($file); |
||
36 | $data->setStatus( |
||
37 | $this->statusService->discoveryStatus( |
||
38 | 'open', |
||
39 | 'open', |
||
40 | $data->getStatus()->getContext() |
||
41 | ) |
||
42 | ); |
||
43 | $this->manager->persist($data); |
||
44 | $this->manager->flush(); |
||
45 | |||
46 | return $data; |
||
47 | } |
||
48 | |||
49 | public function getContractPDFContent(Contract $contract): string |
||
50 | { |
||
51 | $content = $contract->getContractFile()->getContent(); |
||
52 | |||
53 | if ($contract->getContractFile()->getExtension() == 'pdf') |
||
54 | return $content; |
||
55 | |||
56 | if (empty($content)) { |
||
57 | throw new \Exception( |
||
58 | sprintf('Houve um erro ao gerar o PDF') |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | return $this->pdf->convertHtmlToPdf($content); |
||
63 | } |
||
64 | |||
65 | |||
66 | public function postPersist(Contract $contract) |
||
67 | { |
||
68 | if ($contract->getStatus()->getRealStatus() == 'open') |
||
69 | return $this->genetateFromModel($contract); |
||
70 | } |
||
71 | } |
||
72 |
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