ControleOnline /
api-platform-users
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ControleOnline\Controller; |
||
| 4 | |||
| 5 | use ControleOnline\Entity\People; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use ControleOnline\Entity\User; |
||
| 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; |
||
|
0 ignored issues
–
show
The type
ControleOnline\Service\HydratorService 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...
|
|||
| 9 | 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...
|
|||
| 10 | 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...
|
|||
| 11 | use ControleOnline\Service\UserService; |
||
| 12 | |||
| 13 | class CreateUserAction |
||
| 14 | { |
||
| 15 | |||
| 16 | public function __construct( |
||
| 17 | private EntityManagerInterface $manager, |
||
| 18 | private UserService $service, |
||
| 19 | private HydratorService $hydratorService |
||
| 20 | |||
| 21 | ) {} |
||
| 22 | |||
| 23 | public function __invoke(Request $request) |
||
| 24 | { |
||
| 25 | |||
| 26 | try { |
||
| 27 | $payload = json_decode($request->getContent()); |
||
| 28 | $people = $this->manager->getRepository(People::class)->find($payload->people); |
||
| 29 | |||
| 30 | $user = $this->service->createUser( |
||
| 31 | $people, |
||
| 32 | $payload->username, |
||
| 33 | $payload->password |
||
| 34 | ); |
||
| 35 | |||
| 36 | return new JsonResponse( |
||
| 37 | $this->hydratorService->item( |
||
| 38 | User::class, |
||
| 39 | $user->getId(), |
||
| 40 | "user:read" |
||
| 41 | ) |
||
| 42 | ); |
||
| 43 | } catch (\Exception $e) { |
||
| 44 | |||
| 45 | return new JsonResponse([ |
||
| 46 | 'response' => [ |
||
| 47 | 'data' => [], |
||
| 48 | 'count' => 0, |
||
| 49 | 'error' => $e->getMessage(), |
||
| 50 | 'success' => false, |
||
| 51 | ], |
||
| 52 | ], 500); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
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