Description
Hello,
I was following the documentation here https://symfony.com/doc/current/controller/upload_file.html, everything was ok but I was stuck on this part :
Now, create the brochures_directory parameter that was used in the controller to specify the directory in which the brochures should be stored:
# config/services.yaml
# ...
parameters:
brochures_directory: '%kernel.project_dir%/public/uploads/brochures'
When I was trying (I'm on a 7.1 project), on my own controller, I get an error:
Controller "App\Controller\news\NewsController::create" requires the "$bannersDirectory" argument that could not be resolved. Either the argument is nullable and no null value has been provided, no default value has been provided or there is a non-optional argument after this one.
So I changed a bit my services.yaml, removing this "parameters" part, and adding:
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$bannersDirectory: '%kernel.project_dir%/public/uploads/banners'
And it works!
So I was wondering, has the docs a flaw here? Or do I miss a point from newer SF version, about binding and parameters? That totally can be as I have troubles to understand this config/container part.
I can update the doc, but I need to know why my try didn't work, and what is ultimately the most elegant way to do :)