Sunday, 15 March 2015

yaml - symfony: logical operations inside config.yml? -


Is it possible to take logical action in the config.yml file?

For example I tried this:

  width: 50 height: 30 width _ more_heat:% width% +% height%  

But I get an error.

the way you are. But there is a way to work to consider. You can do this in the dependency injection folder inside your bundle extension file. If you can, then take the width and height parameters of the bundle, maybe a core bundle or something else.

  Class Expands My Extension Extension {/ ** * {@inheritdoc} * / Public Function Load $ Configs, Containerbuilder $ Container) {$ Configuration = New Configuration (); $ Config = $ this- & gt; Process configuration ($ configurable, $ configs); $ Loader = new loader \ xml fileloader ($ container, new file locator (__dir __. '/ .. / resource / config')); $ Loader-> Load ('services.xml'); $ Sum = $ Container- & gt; GetParameter ('width') + $ container- & gt; GetParameter ('height'); $ Container- & gt; Setpayeter ('width_more_height', $ sum); }}  

No comments:

Post a Comment