Start your All-Access Pass to unlock this challenge
How to autowire an argument in the constructor of the ImageUploader service? The $kernelDir should be set to the kernel.project_dir parameter.
ImageUploader
$kernelDir
kernel.project_dir
Both B and D are valid.
namespace App\Service; use Symfony\Component\DependencyInjection\Attribute\Autowire; class ImageUploader { public function __construct( #[Autowire('%kernel.project_dir%')] private readonly string $kernelDir, ) { } }
namespace App\Service; use Symfony\Component\DependencyInjection\Attribute\Autowire; class ImageUploader { public function __construct( #[Autowire('kernel.project_dir')] private readonly string $kernelDir, ) { } }
namespace App\Service; use Symfony\Component\DependencyInjection\Attribute\Autowire; class ImageUploader { public function __construct( #[Autowire(param: 'kernel.project_dir')] private readonly string $kernelDir, ) { } }