ControleOnline /
api-platform-common
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ControleOnline\Controller; |
||
| 4 | |||
| 5 | use Symfony\Component\HttpFoundation\Response; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use ControleOnline\Entity\File; |
||
| 7 | use Doctrine\ORM\EntityManagerInterface; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\EntityManagerInterface 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 Loading history...
|
|||
| 8 | use ControleOnline\Service\HydratorService; |
||
| 9 | use ControleOnline\Service\PdfService; |
||
| 10 | use Exception; |
||
| 11 | use Symfony\Component\HttpFoundation\JsonResponse; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\JsonResponse 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 Loading history...
|
|||
| 12 | |||
| 13 | class FileConvertController |
||
| 14 | { |
||
| 15 | |||
| 16 | public function __construct( |
||
| 17 | private EntityManagerInterface $em, |
||
| 18 | private HydratorService $hydratorService, |
||
| 19 | private PdfService $pdf |
||
| 20 | ) {} |
||
| 21 | |||
| 22 | public function __invoke(File $data): Response |
||
| 23 | { |
||
| 24 | |||
| 25 | try { |
||
| 26 | |||
| 27 | if ($data->getFileType() == 'text' && $data->getExtension() == 'html') { |
||
| 28 | |||
| 29 | $data->setFileType('application'); |
||
| 30 | $data->setExtension('pdf'); |
||
| 31 | $data->setContent($this->pdf->convertHtmlToPdf($data->getContent())); |
||
| 32 | $this->em->persist($data); |
||
| 33 | $this->em->flush(); |
||
| 34 | } |
||
| 35 | return new JsonResponse($this->hydratorService->data($data, 'file:read'), Response::HTTP_OK); |
||
| 36 | } catch (Exception $e) { |
||
| 37 | return new JsonResponse($this->hydratorService->error($e)); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
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