Bonjour à tous,
Je n'arrive pas à passer un parametre de type string autre que id dans une opération Get.
Ce que je fais dans mon entity Plateforme
new Get(
uriTemplate: 'plateformes/{theme}',
controller: GetPlatformByThemeController::class,
openapi: new Operation(
summary: 'Selection d\'une plateforme',
description: "Récupère une plateforme selon son theme",
parameters: [
[
'name' => 'theme',
'in' => 'path',
'type' => 'string',
'required' => true,
]
]
),
normalizationContext: [
'groups' => ['read:plateforme', 'read:commune'],
'openapi_definition_name' => 'Read'
],
read: false
)
Ce que je fais avec mon controller
class GetPlatformByIdController extends AbstractController
{
public function __construct(
private readonly PlateformeRepository $repository,
){}
public function __invoke(string $theme): Array
{
//$theme = $request->query->get('theme');
return $this->repository->GetByTheme($theme);
}
}
et voici l'erreur que j'obtiens tout le temps
"@context":"\/contexts\/Error","@id":"\/errors\/500","@type":"Error","title":"An error occurred","detail":"Call to a member function getName() on array","status":500,"type":"\/errors\/500","trace":[{"file":"\/var\/www\/apint\/vendor\/api-platform\/openapi\/Factory\/OpenApiFactory.php","line":244,"function":"hasParameter","class":"ApiPlatform\\OpenApi\\Factory\\OpenApiFactory","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/api-platform\/openapi\/Factory\/OpenApiFactory.php","line":111,"function":"collectPaths","class":"ApiPlatform\\OpenApi\\Factory\\OpenApiFactory","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/api-platform\/symfony\/Bundle\/SwaggerUi\/SwaggerUiProvider.php","line":77,"function":"__invoke","class":"ApiPlatform\\OpenApi\\Factory\\OpenApiFactory","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/api-platform\/state\/Provider\/ContentNegotiationProvider.php","line":51,"function":"provide","class":"ApiPlatform\\Symfony\\Bundle\\SwaggerUi\\SwaggerUiProvider","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/api-platform\/symfony\/Action\/EntrypointAction.php","line":58,"function":"provide","class":"ApiPlatform\\State\\Provider\\ContentNegotiationProvider","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":181,"function":"__invoke","class":"ApiPlatform\\Symfony\\Action\\EntrypointAction","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":76,"function":"handleRaw","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/symfony\/http-kernel\/Kernel.php","line":197,"function":"handle","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/symfony\/runtime\/Runner\/Symfony\/HttpKernelRunner.php","line":35,"function":"handle","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"-\u003E"},{"file":"\/var\/www\/apint\/vendor\/autoload_runtime.php","line":29,"function":"run","class":"Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner","type":"-\u003E"},{"file":"\/var\/www\/apint\/public\/index.php","line":5,"function":"require_once"}],"description":"Call to a member function getName() on array"}
Je ne vois vraiment pas comment m'ensortir
Merci