i'm building large symfony 2 application number of ever increasing bundles i'm struggling keep count of.
i try keep bundles specific each module of system, has provided me nice easy manage structure. isn't nice app/config/config.yml that's grown out of control. understand imports can done within file have helped me i'd move whole range of config specific each bundle should keep these bundles reusable within our other applications.
here of examples of i'd move individual bundles.
1) dependency injection
we use jmsdiextrabundle within internal bundles find makes developing little bit quicker , easier manage.
# annotations/config jms_di_extra: locations: bundles: - appbundle - blogbundle - contentbundle - storebundle - userbundle i'd block moved each individuals bundle config.yml or better yet enabled in each bundles dependencyinjection/appbundleextension.php.
2) routing
use route config, each bundle still needs including within app/config/routing.yml leaving pretty large unmanageable file.
some examples
app: resource: "@appbundle/controller" type: annotation blog: resource: "@blogbundle/controller" type: annotation content: resource: "@contentbundle/controller" type: annotation oneup_uploader: resource: . type: uploader 3) oneup uploader
this biggest biting point, configuration on 500 lines long between 20+ bundles use. here examples pulled app/config/uploader.yml imported config.yml. if somehow these each bundles config i'd happy!
# uploader oneup_uploader: mappings: bundle_name_reference1: frontend: blueimp storage: type: gaufrette filesystem: gaufrette.local_filesystem bundle_name_reference2: frontend: blueimp storage: type: gaufrette filesystem: gaufrette.local_filesystem my thoughts getting these configs each individual bundle, can enable/disable them updating appkernel.php. i'm assuming of possible symfony incredibly flexible, i'm little lost when comes these lower level alterations.
you add
oneup_uploader: #... to src/vendor/whateverbundle/resources/config/services.yml
or
there cookbook entry on how decouple bundles app/config: how load service configuration inside bundle
i think ideal, low-coupling, solution create bundle extending other bundle (e.g. myoneupuploaderbundle) , using cookbook approach there.
Comments
Post a Comment