symfony-cmf / menu-bundle

Extends the KnpMenuBundle to work with PHPCR ODM
https://cmf.symfony.com
32 stars 48 forks source link

InvalidConfigurationException: The path "symfony_cmf_menu.multilang.locales" should have at least 1 element(s) defined. #24

Closed gchokeen closed 11 years ago

gchokeen commented 11 years ago

While I install knp-paginator-bundle few other bundles are updated. After update symfony-cmf/menu-bundle throwing me error

InvalidConfigurationException: The path "symfony_cmf_menu.multilang.locales" should have at least 1 element(s) defined.

Update packages

  - Installing knplabs/knp-components (1.1.2)
    Downloading: 100%         

  - Installing knplabs/knp-paginator-bundle (dev-master 0d719a9)
    Cloning 0d719a9bd6973bde1b10587fc2c85cf04c5e0e9d

  - Updating symfony-cmf/content-bundle dev-master (60b7193 => cfc7bd9)
    Checking out cfc7bd953490618ee29e3a15adedf4016e555a73

  - Updating symfony-cmf/menu-bundle dev-master (4d8a1b8 => e72d283)
    Checking out e72d28319994e638a8fa08e8237ac55c2f93fd88

  - Updating symfony-cmf/routing-extra-bundle dev-master (3af0d4c => 6dd5837)
    Checking out 6dd58373626dd9f4c1603ec04c0f14b720f33060

Help me solve the issue

dbu commented 11 years ago

wow, that was fast :-)

this is because we merged #23 this morning. you need to define that parameter. for now the easiest thing is to do it like we have in the sandbox with a %locales% parameter: https://github.com/symfony-cmf/cmf-sandbox/blob/master/app/config/config.yml#L124

@EmmanuelVella: would you mind doing a PR to update symfony-cmf-docs the sections about multilang configuration to explain that locales is now required if you have any multilang configuration?

gchokeen commented 11 years ago

I changed

symfony_cmf_menu:
    menu_basepath:        /cms/menu
    document_manager_name:  default
    admin_class:          ~
    document_class:       ~
    content_url_generator:  router
    content_key:          ~ # (resolves to DynamicRouter::CONTENT_KEY)
    route_name:           ~ # cmf routes are created by content instead of name
    content_basepath:     ~ # defaults to symfony_cmf_core.content_basepath
    use_sonata_admin:     auto # use true/false to force using / not using sonata admin
    multilang:
        use_sonata_admin:     auto # use true/false to force using / not using sonata admin
        admin_class:          ~
        document_class:       ~
        locales: []

to

symfony_cmf_menu:
    menu_basepath:        /cms/menu
    document_manager_name:  default
    admin_class:          ~
    document_class:       ~
    content_url_generator:  router
    content_key:          ~ # (resolves to DynamicRouter::CONTENT_KEY)
    route_name:           ~ # cmf routes are created by content instead of name
    content_basepath:     ~ # defaults to symfony_cmf_core.content_basepath
    use_sonata_admin:     auto # use true/false to force using / not using sonata admin
    multilang:
        use_sonata_admin:     auto # use true/false to force using / not using sonata admin
        admin_class:          ~
        document_class:       ~
        locales: %locales%

But now I am getting different error

ParameterNotFoundException: You have requested a non-existent parameter "locales".

Thanks for instant reply!

dbu commented 11 years ago

to use %locales% in your config.yml, you need to define it in parameters.yml. see the parameters.yml.dist of the sandbox. or if you do not use other cmf bundles than this one, just put the locales directly here, as in locales: [en, fr]

EmmanuelVella commented 11 years ago

You need to define the %locales% parameter (in your parameters.yml file for example)

locales: [en, de, fr]

EmmanuelVella commented 11 years ago

@dbu Sure I will prepare a PR for the docs

gchokeen commented 11 years ago

Thank you issue resolved, But i have one doubt I have already one parameter locale: en. whats the difference locale and locales, should I keep both

    locale: en
    locales: [en]
dbu commented 11 years ago

the idea of the locales is to have multilanguage, so you could have a list of locales to use. locale is the default locale to be used if none is set from the request.

if your application is monolingual, it should be possible to remove the whole multilang section from your config and use the documents in their non-multilang version. (there are 2 classes, one for multilang and the base one)

gchokeen commented 11 years ago

@dbu : Great explanation thank you so much.

lsmith77 commented 11 years ago

closing this ticket.