I have an interface:
<?php
interface FooInterface
{
function doSth();
}
and two classes that implements this interface:
<?php
class FooImplementationOne implements FooInterface
{
}
class FooImplementationTwo implements FooInterface
{
}
And now i want to autowire one of classes that implements FooInterface based on called endpoint:
<?php
class Service
{
public function __construct(
private FooInterface $interface
);
}
Is there any chance to achieve that using some kind of Resolver/Provider?
I've tried implementing class that implements ServiceSubscriberInterface (this didnt work at all) and another one class implementing ArgumentValueResolverInterface (that one worked for controllers, but obviously not for services :( )