error The attribute "name" must be set for path "doctrine.orm.entity_managers.db2.mappings" with multiple databases

Sarah Richardson

I have a project that uses two databases. The Doctrine section of Config.yml bundle is setup as follows.

doctrine:
    dbal:
        default_connection: db1
        connections:
            db1:
                driver:   pdo_mysql
                host:     "%database_host2%"
                port:     "%database_port2%"
                dbname:   "%database_name2%"
                user:     "%database_user2%"
                password: "%database_password2%"
                charset:  UTF8
            db2:
                driver:   pdo_mysql
                host:     "%database_host%"
                port:     "%database_port%"
                dbname:   "%database_name%"
                user:     "%database_user%"
                password: "%database_password%"
                charset:  UTF8
    orm:
        default_entity_manager: em1
        entity_managers:
            em1:
                connection: db1
                mapping:
                    FirstBundle: ~
            em2:
                connection: db2
                mappings:
                    SecondBundle: ~

All the parameters are setup in the parameters.yml file correctly.

whenever I run any $ php bin/console commands I get the following error

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]             
  The attribute "name" must be set for path "doctrine.orm.entity_managers.em2.mappings".

Are there any settings that I'm missing?

Alvin Bunk

I notice your em1 section is set to mapping instead of mappings. Also, in my working config, I set default_entity_manager to the connection value. So maybe try making these changes:

orm:
    default_entity_manager: db1
    entity_managers:
        em1:
            connection: db1
            mappings:
                FirstBundle: ~
        em2:
            connection: db2
            mappings:
                SecondBundle: ~

That may not be the problem, but try it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Error creating bean with name 'authenticationProvider' : A UserDetailsService must be set

The attribute name of [ *ngIf ] must be in lowercase

Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions

set a href attribute on svg path

Set JSON attribute by path

Gulp error: Path must be a string

Second path fragment must not be a drive or UNC name

TypeError: getattr(): attribute name must be string in Django

Angular error: If ngModel is used within a form tag, either the name attribute must be set or

The path in 'value' must start with '/'. Parameter name: value

GraphQL Error : Must provide name

How to solve Prometheus configuration error: file service discovery config must contain at least one path name

Scrapy: SELENIUM_DRIVER_NAME and SELENIUM_DRIVER_EXECUTABLE_PATH must be set

getting error Dropdown `value` must be an array when `multiple` is set

Set Attribute With Same Name As Databse Field in Laravel returns Error

Error with database file path in project with many databases

error APT2008: attribute 'android:name' in <service> tag must be a valid Java class name

ERROR: Function name must be a string

Retrieve records from same name table from multiple databases in single result set

set PATH with multiple lines

Ionic2 - Error - If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as 'standalone'

Django Error : hasattr(): attribute name must be string

Selenium webdriver gecko error: The path to the driver must be set by webdriver.gecko

HTML Syntax error in eclipse for angular directives - Attribute name must be followed by the ' = ' character

Geckodriver Error: Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by

If ngModel is used within a form tag, either the name attribute must be set

Terraform set GCP name tag Incorrect attribute value type error

Java set attribute of buildup name

Power Bi Desktop Error Message: Each original name must belong to the set of all names