Questions tagged [symfony-config-component]
14 questions
126
votes
5 answers
How to get the root dir of the Symfony2 application?
What is the best way to get the root app directory from inside the controller? Is it possible to get it outside of the controller?
Now I get it by passing it (from parameters) to the service as an argument, like this:
services:
sr_processor:
…

Dawid Ohia
- 16,129
- 24
- 81
- 95
5
votes
4 answers
How to convert symfony yaml config files to xml format?
I'd like to have Symfony configuration files as XML files.
I know, there are many code examples in the symfony-book but not all configurations-types are shown.
Is there any way to convert the existing YAML files given from the Symfony demo project…

mystack
- 75
- 2
- 4
3
votes
1 answer
Referencing Nested Parameters in Symfony 4 Configuration Files
I would like to be able to use nested parameters defined in one configuration file in another for examle
# config/config.yaml (my custom configuration file)
database:
driver: pdo_mysql
host: localhost
user: dev
password: dev
…

Stephen Senkomago Musoke
- 3,528
- 2
- 29
- 27
1
vote
0 answers
Am I missing something or is the Symfony Config component documentation misleading regarding the root configuration node?
Under Defining and Processing Configuration Values in the documentation for the Symfony Config component, it's implied that the root node name you pass to the TreeBuilder constructor will be seen as a node at the root of the configurations the…

Andrew Dinmore
- 804
- 7
- 14
1
vote
1 answer
Configure a symfony database connection from ini file?
On the server I need to deploy my symfony 5.2.4 application, the database configuration is defined in an ini file for which the path is set as an environment variable.
The way I have done it right now is to run composer dump-env dev then in…

Sylvain
- 318
- 2
- 10
1
vote
0 answers
Alter part of Symfony Configuration TreeBuilder
I have a parent configuration specification
GenericDatabaseAdapterConfiguration implements ConfigurationInterface
It has some default values - host, user and password. Then there are children that have their specific configuration options.…

Tomáš Fejfar
- 11,129
- 8
- 54
- 82
1
vote
1 answer
How do I set domain based configuration in Symfony 3.4?
So I have set up a Symfony 3.4 application, which I downloaded following the instructions here using the Symfony Installer:
https://symfony.com/download
I am building this app for my employer to run within multiple eCommerce sites. It will not only…

space97
- 153
- 1
- 4
- 19
1
vote
1 answer
Config file of FOSRestBundle 2.3?
I'm looking for configuration's path of FOSRestBundle 2.3.
I have Symfony 2.8.
I have checked app/config/config.yml but nothing about fos_rest :/
When I type PHP app/console config:debug fos_rest I got the configuration of this bundle.
Please help !

Casual
- 11
- 3
1
vote
1 answer
How to load different configurations in the same file using different Configurations (ConfigurationInterface) in Symfony
I'm using the following Symfony components:
"require": {
"symfony/dependency-injection": "~3.0",
"symfony/yaml": "~3.0",
"symfony/config": "~3.0",
"symfony/console": "~3.0",
"symfony/validator": "~3.0",
…

JorgeeFG
- 5,651
- 12
- 59
- 92
0
votes
1 answer
Symfony constraint-mapping do not see env variables
I have following .env file:
VAR=8888
I want to use this variable from .env file in the constraint config file. So I do this:

dosad
- 151
- 7
0
votes
1 answer
How do I define an array of arrays of scalars in Symfony Configuration.php?
I want to parse a YAML configuration that looks like this:
pageRoles:
Report1: [abc, xyz, def]
Report2: [fgh, xxx, yyy, rrr]
I want the resulting configuration array to look like this:
'pageRoles':
'Report1':
[
'abc',
'xyz',
…

David Patterson
- 1,780
- 3
- 17
- 40
0
votes
1 answer
Custom configuration file for Symfony project
My goal is to add to a new Symfony 4.4 project an extra config file to define some behavior of the system. It could be anything, like, pancakes.yaml:
pancakes:
enablePancakes: false
I wish to know how can I load that config file. find a way to…

H3lltronik
- 562
- 8
- 26
0
votes
1 answer
Symfony3 configuration component validation
Community I need your help. I have config file:
payments:
methods:
paypal:
enabled: false
allowed_countries:
-
- ...
credit_card:
disallowed_countries:
…

Alex
- 49
- 6
-2
votes
1 answer
Symfony access parameters from services.yaml in Entity
In Symfony 5.0 I need to access parameters defined in services.yaml inside an entity.
When injecting the parameter_bag in services.yaml into my entity like
App\Entity\MyEntity:
class: App\Entity\MyEntity
calls:
- [setParameterBag,…

user3440145
- 793
- 10
- 34