php - Symfony2 - doctrine connection configuration in bundle -
i have project uses additional bundle. bundle connects other database , need configuration database.
i want have connections in 2 config files.
main config:
# root/app/config/config.yml: doctrine: dbal: default_connection: default connections: default: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8
bundle config:
# src/secondbundle/resources/config/config.yml doctrine: dbal: connections: secondbundle: driver: "%secondbundle.database_driver%" host: "%secondbundle.database_host%" port: "%secondbundle.database_port%" dbname: "%secondbundle.database_name%" user: "%secondbundle.database_user%" password: "%secondbundle.database_password%" charset: utf8
bundle extension file:
class secondbundleextension extends extension { /** * {@inheritdoc} */ public function load(array $configs, containerbuilder $container) { $configuration = new configuration(); $config = $this->processconfiguration($configuration, $configs); $loader = new loader\yamlfileloader($container, new filelocator(__dir__.'/../resources/config')); $loader->load('config.yml'); } }
in opinion looks ok, when i'm trying run have communicate:
there no extension able load configuration "doctrine"
you can add config imports in app/config/config.yml
merged full config
.
app/config/config.yml
imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: '@secondbundle/resources/config/config.yml' }
updated quotes due fact a non-quoted string cannot start @ or ` (reserved) nor scalar indicator (| or >)
since version 3.0.
Comments
Post a Comment