0

I'm trying to configure to work with two databases and I have such a configuration:

doctrine:
    dbal:
      connections:
        default:
          driver:   %database_driver%
          host:     %database_host%
          port:     %database_port%
          dbname:   %database_name%
          user:     %database_user%
          password: %database_password%
          charset:  UTF8
        zaweb:
          driver:  %database_driver%
          host:    %database_host%
          port:    %database_port%
          dbname:  "zyabypoel"
          user:    %database_user%
          password: %database_password%


      types:
          json: Sonata\Doctrine\Types\JsonType

    orm:
        default_entity_manager: default
        entity_managers:
            default:
              connection: default
            zaweb:
              connection: zaweb
              mappings:
                  ZaWebMenuBundle: ~
                  ZaWebGeoBundle: ~
                  ZaWebApiBundle: ~
                  ZaWebSiteBundle: ~
                  ZaWebAdminBundle: ~

        filters:
            softdeleteable:
                class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                enabled: true
        result_cache_driver: apc
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true

When I run php app/console doctrine:database:create --connection=zaweb I get the error: Unrecognized options "filters, result_cache_driver, auto_mapping" under "doctrine.orm"

This error appeared when I added a second connection to that it was not. Why?

1 Answer 1

1

filters belongs inside doctrine.orm.entity_managers.manager. So you have to move this option to the right in your file, so it is not next to, but inside an entity manager.

auto_mapping and result_cache_driver also belong inside a concrete entity_manager, e.g. inside zaweb.

See here: http://symfony.com/doc/current/reference/configuration/doctrine.html

EDIT: Sorry, now I also messed up the indentation. It's fixed now. In the end it could actually look like this:

orm:
    default_entity_manager: default
    entity_managers:
        default:
            connection: default
        zaweb:
            connection: zaweb
            result_cache_driver: apc
            auto_mapping: true
            mappings:
                ZaWebMenuBundle: ~
                ZaWebGeoBundle: ~
                ZaWebApiBundle: ~
                ZaWebSiteBundle: ~
                ZaWebAdminBundle: ~
            filters:
                softdeleteable:
                    class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                    enabled: true
    auto_generate_proxy_classes: %kernel.debug%
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.