symfony - Symfony2. Howto multiple config files in a bundle -


i can't figure out.

i writing report builder in symfony2.

i have config file this:

bundle:   sections:     report1:       buckets:         bucket1:         ...       calculations:         calculation1:         ...       report:         rows:           row1:           ... 

for several reports, gets loooong.

i've tried breaking file smaller files , loading them separately. didn't work. here's tried:

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('bundle_report.yml');     $loader->load('bundle_report_1.yml');  // order important here     $loader->load('bundle_report_2.yml');     $loader->load('bundle_report_3.yml');     $loader->load('services.yml'); } 

what's best way this? possible?

the error i'm getting (exception thrown before $loader->load()s happen):

the child node "sections" @ path "bundle" must configured 

if switch order ( $loader->load()s first, new configuration()):

 there no extension able load configuration "bundle" 

configuration looks this:

public function getconfigtreebuilder() {     $treebuilder = new treebuilder();     $rootnode = $treebuilder->root('bundle');      $rootnode         ->children()             ->arraynode('sections')->isrequired()                 ->prototype('array')                 ... 

you not supposed load config files load method. made

  • load base config configuration class
  • compare custom config (yml files in app/config/)
  • and load bundle services

all config files must in app/config/ passed parameters load method. here, useless. that's why

the child node "sections" @ path "bundle" must configured 

and if reports evolving, maybe it's better put in business logic (model/entities) , plug admin (eg: sonata admin).


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -