From 76f452fb0b645a8c2e79b9c8379ca2eb90734bd1 Mon Sep 17 00:00:00 2001 From: bkb_bkb <39589466+foybkaa@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:01:47 +0200 Subject: [PATCH 1/3] Use #[Autowire] attribute in FileUploader service example Replaced the YAML-based injection of the uploads_directory parameter with the #[Autowire] attribute directly in the FileUploader constructor. This avoids service configuration issues and ensures the example works out of the box with modern Symfony versions. --- controller/upload_file.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index b3dc2d6ffd0..5da7274f239 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -240,7 +240,7 @@ logic to a separate service:: class FileUploader { public function __construct( - private string $targetDirectory, + #[Autowire('%brochures_directory%')] private string $targetDirectory, private SluggerInterface $slugger, ) { } From a499cc7b881f1ce507520b3f88df835c02df9b88 Mon Sep 17 00:00:00 2001 From: bkb_bkb <39589466+foybkaa@users.noreply.github.com> Date: Thu, 24 Apr 2025 16:55:28 +0200 Subject: [PATCH 2/3] Update controller/upload_file.rst Co-authored-by: Oskar Stark --- controller/upload_file.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index 5da7274f239..7e55d25a8bc 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -240,7 +240,8 @@ logic to a separate service:: class FileUploader { public function __construct( - #[Autowire('%brochures_directory%')] private string $targetDirectory, + #[Autowire('%brochures_directory%')] +private string $targetDirectory, private SluggerInterface $slugger, ) { } From 376adaf19b389041a7511ffc16e1ffb1550c265e Mon Sep 17 00:00:00 2001 From: bkb_bkb <39589466+foybkaa@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:06:36 +0200 Subject: [PATCH 3/3] Update upload_file.rst --- controller/upload_file.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index 7e55d25a8bc..8c2c7512494 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -241,7 +241,7 @@ logic to a separate service:: { public function __construct( #[Autowire('%brochures_directory%')] -private string $targetDirectory, + private string $targetDirectory, private SluggerInterface $slugger, ) { }