ControleOnline /
api-platform-common
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ControleOnline\Controller; |
||
| 4 | |||
| 5 | use ControleOnline\Entity\DeviceConfig; |
||
| 6 | use ControleOnline\Entity\People; |
||
|
0 ignored issues
–
show
|
|||
| 7 | use ControleOnline\Service\DeviceService; |
||
| 8 | use ControleOnline\Service\HydratorService; |
||
| 9 | use Symfony\Component\HttpFoundation\Request; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\Request 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...
|
|||
| 10 | 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...
|
|||
| 11 | use Exception; |
||
| 12 | 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...
|
|||
| 13 | use Symfony\Component\HttpFoundation\Response; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\Response 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...
|
|||
| 14 | |||
| 15 | class AddDeviceConfigAction |
||
| 16 | { |
||
| 17 | public function __construct( |
||
| 18 | private EntityManagerInterface $manager, |
||
| 19 | private HydratorService $hydratorService, |
||
| 20 | private DeviceService $deviceService |
||
| 21 | ) {} |
||
| 22 | |||
| 23 | public function __invoke(Request $request): JsonResponse |
||
| 24 | { |
||
| 25 | try { |
||
| 26 | $json = json_decode($request->getContent(), true); |
||
| 27 | $device = $request->headers->get('device'); |
||
| 28 | $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people'])); |
||
| 29 | $configs = json_decode($json['configs'], true); |
||
| 30 | $device_config = $this->deviceService->addDeviceConfigs($people, $configs, $device); |
||
| 31 | return new JsonResponse($this->hydratorService->item(DeviceConfig::class, $device_config->getId(), 'device_config:read'), Response::HTTP_OK); |
||
| 32 | } catch (Exception $e) { |
||
| 33 | return new JsonResponse($this->hydratorService->error($e)); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 |
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