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

ConfigResolver::getParameter returns incorrect languages order

    XMLWordPrintable

Details

    Description

      My configuration:

      ezpublish: 
          # HttpCache settings, By default 'local' (Symfony HttpCache Proxy), by setting it to 'http' you can point it to Varnish
          # You may also set it to 'fastly' if you want to use the fastly CDN
          http_cache: 
              purge_type: '%purge_type%'
      
          # Repositories configuration, setup default repository to support solr if enabled
          repositories: 
              default: 
                  storage: ~
                  search: 
                      engine: '%search_engine%'
                      connection: default
      
          # Siteaccess configuration, with one siteaccess per default
          siteaccess: 
              list: [site, admin, test2, test3]
              groups: 
                  site_group: [site, test2, test3]
      
                  # WARNING: Do not remove or rename this group.
                  # It's used to distinguish common siteaccesses from admin ones.
                  # In case of multisite with multiple admin panels, remember to add any additional admin siteaccess to this group.
                  admin_group: [admin]
              default_siteaccess: site
              match: 
                  URIElement: 1
      
          # System settings, grouped by siteaccess and/or siteaccess group
          system: 
              site_group: 
                  # Cache pool service, needs to be different per repository (database) on multi repository install.
                  cache_service_name: '%cache_pool%'
                  # These reflect the current installers, complete installation before you change them. For changing var_dir
                  # it is recommended to install clean, then change setting before you start adding binary content, otherwise you'll
                  # need to manually modify your database data to reflect this to avoid exceptions.
                  var_dir: var/site
                  # System languages. Note that by default, content, content types, and other data are in eng-GB locale,
                  # so removing eng-GB from this list may lead to errors or content not being shown, unless you change
                  # all eng-GB data to other locales first.
                  languages: [eng-GB]
                  content: 
                    # As we by default enable EzSystemsPlatformHttpCacheBundle which is designed to expire all affected cache
                    # on changes, and as error / redirects now have separate ttl, we easier allow ttl to be greatly increased
                    default_ttl: '%httpcache_default_ttl%'
                  # HttpCache purge server(s) setting, eg Varnish, for when ezpublish.http_cache.purge_type is set to 'http'.
                  http_cache: 
                      # If using fastly, 'purge_server' must be set to 'https://api.fastly.com'
                      purge_servers: ['%purge_server%']
                      fastly: 
                          service_id: '%fastly_service_id%'
                          key: '%fastly_key%'
      
              # WARNING: Do not remove or rename this group.
              admin_group: 
                  cache_service_name: '%cache_pool%'
                  var_dir: var/site
                  languages: [eng-GB]
                  content: 
                      default_ttl: '%httpcache_default_ttl%'
                  http_cache: 
                      purge_servers: ['%purge_server%']
                      fastly: 
                          service_id: '%fastly_service_id%'
                          key: '%fastly_key%'
      
              test2:
                  languages: [pol-PL, eng-GB]
              test3:
                  languages: [fra-FR, eng-GB]
      

      Calling

      $configResolver->getParameter('languages', null, 'test2')

      will return

      [eng-GB, pol-PL]

      This makes it impossible to get primary language for the siteaccess as it should be first element of the array.

      Remark: array reverse won't do the job as it might seem in this example, in fact order can be totally random as a consequence of how arrays are merged.

      Attachments

        Activity

          People

            Unassigned Unassigned
            maciej.kobus@ibexa.co Maciej Kobus
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: