eZ Community » Forums » eZ Publish 5 Platform » Bundle Configuration - good practices
expandshrink

Bundle Configuration - good practices

Bundle Configuration - good practices

Wednesday 05 November 2014 12:40:40 pm - 2 replies

Hello,

currently i am developing a new bundle for our ezpublish. Until now i had all my config related code directly inside my code using a pseudo configuration class which has all configuration as constants.

I am not really sure how to make my bundle configuration friendly. Symfony says never changing values could be stored inside a php class as constants. This part is clear.

But later my bundle will be used by many siteaccesses and i am not sure, how to handle this right. I could include a parameter.yml and take care of siteaccesses like:

acme.ezdemo_site_admin.param: "adminstring"
acme.ezdemo_site.param: "noadminstring"

and then get it with something like 

$this->getContainer()->getParameter('acme.' . $scope . '.param');  //$scope contains current Siteaccess

But it is also possible, to create siteaccess based configs as eZ described in their cookbook:

https://doc.ez.no/display/EZP/How...+aware+configuration+for+your+bundle

but this recipe seems only available to ez5.4 and we are using 5.2 (soon 5.3).

So, is there a better way than my "parameter"-abuse?

 

Best regards,

Jacob

Modified on Wednesday 05 November 2014 12:42:31 pm by Jacob Ester

Friday 07 November 2014 3:43:06 pm

Hi Jacob

You should use the ConfigResolver instead of the container.

As for the recipe you're pointing out, it's indeed a new feature in 5.4 and there is currently no easy way to implement this in previous versions.

Tuesday 18 November 2014 12:11:19 pm

Hi Jérôme,

thank you for your answer. I will use the ConfigResolver.

Best regards,

Jacob

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from