I'm using Symfony 6 and Flysystem 3, and depending on a parameter I want to pick one of the 2 adapters I have.
I don't want to instantiate both of them in the constructor since I'm only using 1 per execution (it's a Consumer).
Tried to instantiate the Container and use $container->get('my.adapter'):
public function __construct(
private readonly ContainerInterface $container
) {
}
However I'm missing something:
Cannot autowire service "App\Consumer\MyConsumer": argument "$container" of method "__construct()" references interface "Symfony\Component\DependencyInjection\ContainerInte rface" but no such service exists. You should maybe alias this interface to the existing "service_container" service.
Any ideas??