1 | <?php |
||
2 | |||
3 | namespace ControleOnline\DataProvider; |
||
4 | |||
5 | use ApiPlatform\Metadata\Operation; |
||
0 ignored issues
–
show
|
|||
6 | use ApiPlatform\State\ProviderInterface; |
||
0 ignored issues
–
show
The type
ApiPlatform\State\ProviderInterface 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 ![]() |
|||
7 | use ControleOnline\Entity\People; |
||
0 ignored issues
–
show
The type
ControleOnline\Entity\People 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 ![]() |
|||
8 | use ControleOnline\Service\DeviceService; |
||
9 | 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 ![]() |
|||
10 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface |
||
0 ignored issues
–
show
The type
Symfony\Component\Securi...e\TokenStorageInterface 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 ![]() |
|||
11 | as Security; |
||
12 | use ControleOnline\Entity\Device; |
||
13 | use ControleOnline\Service\HydratorService; |
||
14 | use Exception; |
||
15 | 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 ![]() |
|||
16 | |||
17 | class PrinterDataProvider implements ProviderInterface |
||
18 | { |
||
19 | |||
20 | public function __construct( |
||
21 | private EntityManagerInterface $entityManager, |
||
22 | private HydratorService $hydratorService, |
||
23 | private Security $security, |
||
24 | private DeviceService $deviceService |
||
25 | |||
26 | ) {} |
||
27 | |||
28 | public function provide(Operation $operation, array $uriVariables = [], array $context = []): JsonResponse |
||
29 | { |
||
30 | try { |
||
31 | $currentUser = $this->security->getToken()->getUser(); |
||
32 | if (!$currentUser && !$this->security->isGranted('ROLE_ADMIN')) { |
||
33 | throw new \Exception('You should not pass!!!'); |
||
34 | } |
||
35 | $filters = $context['filters']; |
||
36 | $people = $this->entityManager->getRepository(People::class)->find($filters['people']); |
||
37 | $printers = $this->deviceService->getPrinters($people); |
||
38 | return new JsonResponse($this->hydratorService->collectionData($printers, Device::class, 'device:read')); |
||
39 | } catch (Exception $e) { |
||
40 | return new JsonResponse($this->hydratorService->error($e)); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |
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