dic

warning: Creating default object from empty value in /var/drupal/modules/taxonomy/taxonomy.pages.inc on line 33.

Symfony2 arrays as parameters in xml dependeny injection

Symfony documentation recommends to use XML for dependency injection configuration. I like the yml format because its simple and intuitive, but the main benefit of XML is the possibility for better validation and editing help.
So today we tried to port some configuration from yaml to xml.
Our yaml file contained an array parameter:

parameters:
    symfony_cmf_multilang_content.lang_preference:
        en: [en, de]
        de: [de, en]

To make this work in XML, you need to nest parameter tags and use the type="collection" attribute.

<parameters>
    <parameter key="symfony_cmf_multilang_content.lang_preference" type="collection">
        <parameter key="en" type="collection">
            <parameter>en</parameter>
Syndicate content