Start your All-Access Pass to unlock this challenge
How to autowire an argument in the constructor of the ImageUploader service? The $fileUploader argument should be autowired to a non-autowirable service with ID aws.s3_file_uploader.
ImageUploader
$fileUploader
aws.s3_file_uploader
namespace App\Service; use Aws\Service\S3FileUploader; use Symfony\Component\DependencyInjection\Attribute\Autowire; class ImageUploader { public function __construct( #[Autowire('aws.s3_file_uploader')] private readonly S3FileUploader $fileUploader, ) { } }
Both C and D are valid.
namespace App\Service; use Aws\Service\S3FileUploader; use Symfony\Component\DependencyInjection\Attribute\Autowire; class ImageUploader { public function __construct( #[Autowire('@aws.s3_file_uploader')] private readonly S3FileUploader $fileUploader, ) { } }
namespace App\Service; use Aws\Service\S3FileUploader; use Symfony\Component\DependencyInjection\Attribute\Autowire; class ImageUploader { public function __construct( #[Autowire(service: 'aws.s3_file_uploader')] private readonly S3FileUploader $fileUploader, ) { } }