I'm using Symfony 5.3 and the Symfony RateLimiter bundle.
For this to work, a method should be called by:
public function root(Request $request, RateLimiterFactory $authenticationApiLimiter)
{
}
A RateLimiterFactory requires that the variable be called $authenticationApiLimiter to correctly autowire. However, this project uses the snake_case variables standard.
How do I either alias or change this?
Thanks
I like most of Symfony's design but they tend to get a bit carried away when it comes to automatically naming things. The best full time solution really is to follow the Symfony standard and just live with it. However you can use bind to change the argument name if you really want to.
Instead of a named alias you could also just use a bind. I think the alias is bit more specific but they both work.
To figure out the service id, start by creating a new 5.3 project, installing symfony/rate-limiter and then copying the rate_limiter.yaml file from the docs to config/packages.
The limiter.anonymous_api is the key. You can use the service in the named aliases.