Open
Description
Description
I have multiple implementations for my interface. I want to inject the service typed by its interface + argument. Same as https://symfony.com/doc/current/service_container/autowiring.html#dealing-with-multiple-implementations-of-the-same-type but with attributes.
What do you guys think? I'd be able to create a PR if accepted.
Example
<?php
namespace Foo;
use Symfony\Component\DependencyInjection\Attribute\AsAlias;
#[AsAlias(argument: 'one']
final class MyAdapterClassOne implements \Bar\MyInterface
{
// ...
}
#[AsAlias(argument: 'two']
final class MyAdapterClassTwo implements \Bar\MyInterface
{
// ...
}
<?php
namespace Services;
final class MyService
{
public function __construct(private \Bar\MyInterface $one) //MyAdapterClassOne class is injected
{
}
}