Answer the question
In order to leave comments, you need to log in
How to substitute the value of the previous parameter in the Symfony2 bundle configuration?
There is a bundle where you need to upload files. I plan to store two paths in the config - an external path to a specific directory where the downloaded file will be saved and an internal path to the web directory. From these two paths, you can get both the full internal path for moving the file after downloading, and generate an address for display on the web.
At the moment the configuration looks something like this:
some_bundle:
xxx:
title_image:
web_root_path: /uploads/xxx
upload_root_path: %kernel.root_dir%/../web%web_root_path%
thumbnails:
enabled: true
width: 600
height: 400
ParameterNotFoundException: You have requested a non-existent parameter "web_root_path".
Answer the question
In order to leave comments, you need to log in
Official documentation for all Spring projects . Each project has links to sample applications using that project.
You only have access to those parameters that are registered in DI at the time you start parsing the config. That is, %kernel.root_dir% is available there (as well as a bunch of other parameters), but you yourself must register %web_root_path% as a parameter in YourBundle/DependencyInjection/Extension.
it is better to specify the full path where to save, and the path to web_root separately.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question