Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27702

Configuration - missing possibility to add default values to siteaccess configuration

    XMLWordPrintable

Details

    Description

      While creating bundle configuration according to documentation user is supposed to use generateScopeBaseNode method. The issue is that this method adds a prototype and you are not allowed to set default values to prototype nodes (by using addDefaultsIfNotSet method).

      Let's consider following configuration (it's modified configuration coming from customer request):

      $systemNode = $this->generateScopeBaseNode($rootNode);
      $systemNode->integerNode('item_a')
                      ->defaultValue( 10 )
                  ->end()
              ->end();
      

      Now, once configuration in ezplatform.yml is like following:

      app_bundle:
          system:
              site_group:
                  item_a: 100
      

      all is working well. However once ezplatform.yml is following:

      app_bundle:
      

      then default value for item_a is not used, item_a is undefined. The result of app/console config:debug app_bundle is (note there's no item_a at all):

      app_bundle:
          system: { }
      

      Now, take a look at pure Symfony configuration (no generateScopeBaseNode hence no prototype included so use of addDefaultsIfNotSet usage is possible):

      $rootNode
                  ->children()
                      ->arrayNode('system')
                      ->addDefaultsIfNotSet()
                      ->children()
                          ->integerNode('item_a')
                          ->defaultValue(10)
                      ->end()
                  ->end()
                  ->end()
              ;
      

      And then, once ezplatform.yml has:

      app_bundle:
      

      Command app/console config:debug app_bundle returns:

      app_bundle:
          system:
              item_a: 10
      

      And this is desired outcome.

      Now, I see 3 options:
      1. The configuration part which is done in Bundle's configuration (code written by users) should be written in some other way. In this option there's no need to change from eZ side, but how to write such configuration ?
      2. generateScopeBaseNode requires some changes to allow users to define default values which will be used further
      3. Since we are operating on prototype node we (users) are not able to set default values. In this case this is internal Symfony's limitation / bug / feature and we can't do much here

      Attachments

        Activity

          People

            Unassigned Unassigned
            tomasz.madeyski-obsolete@ez.no Tomasz Madeyski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: