Closed
Description
Symfony version(s) affected
6.3
Description
The attribute #[AutowireCallable] works using constructor injection, but it does not function when directly used in the controller method.
How to reproduce
#[Route(
path: "/playground",
name: "playground",
methods: ["GET"]
)]
public function play(#[AutowireCallable(service: WelcomeGreet::class, method: 'greetMessage')]
GreetInterface $greet):Response
{
$message = $greet->greetMessage();
return new Response($message);
}
Error: Argument #1 ($greet) must be of type App\Interface\GreetInterface ,array given.
Possible Solution
No response
Additional Context
No response