Xander
Xander

Reputation: 1244

Symfony 2 config file and bundles configuration

I'm developing a symfony2-based app and I'm using doctrine for db access. My entities are not in standard directory so I have to configure entities for each bundle in config file. Same goes for embeddables configuration and few custom data types.

The problem is that config.yml is getting pretty huge. I'd like to split that config so all custom types and other bundle-related doctrine config would sit in bundle's directory. Is that possible with symfony2?

Upvotes: 0

Views: 134

Answers (1)

Tomasz Madeyski
Tomasz Madeyski

Reputation: 10890

Yes, it is possible. You can use imports clause and split your configuration into separate files:

config.yml:

imports:
    - { resource: path/to/your/separate/file.yml }
    - { resource: path/to/your/another/separate/file.yml }
    #you can also use your bundle name as a part of path
    - { resource: @AppBundle/Resources/config/local_whatever_config.yml }

#now regular configuration goes:
framework:
    secret: %secret%

Upvotes: 1

Related Questions