Symfony2 Doctrine ORM Manager named “db2” does not exist

Nietono Shana

I create YML entity, generate entity and config multiple connections

config.yml

# Doctrine Configuration
doctrine:
dbal:
    default_connection: db1
    connections:
        db1:
            driver:   '%database_driver%'
            host:     '%database_host%'
            port:     '%database_port%'
            dbname:   '%database_name%'
            user:     '%database_user%'
            password: '%database_password%'
            charset:  UTF8
        db2:
            driver:   '%database_driver2%'
            host:     '%database_host2%'
            port:     '%database_port2%'
            dbname:   '%database_name2%'
            user:     '%database_user2%'
            password: '%database_password2%'
            charset:  UTF8
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true

my orm.yml

TestBundle\Entity\Test:
type: entity
table: Test
id:
    id:
        type: integer
        nullable: false
        options:
            unsigned: true
        id: true
fields:
    name:
        type: string
        nullable: false
        length: 255
        options:
            fixed: false
lifecycleCallbacks: {  }

after clean cache and generate entities, I try to run this code (in command controller)

<?php 

...

protected function execute(InputInterface $input, OutputInterface $output)
{
    $doctrine = $this->getContainer()->get('doctrine')->getManager('db2');
    //both methods cant work :( db2_entity_manager not found
    $doctrine = $this->getContainer()->get('doctrine.orm.db2_entity_manager');

    $test = $doctrine->getRepository('DionisDataBaseBundle:Test');

}

And I have error:

[InvalidArgumentException]
Doctrine ORM Manager named "db2" does not exist.

Nietono Shana

change config.yml to

 orm:
    auto_generate_proxy_classes: "%kernel.debug%"
    default_entity_manager: db1
    entity_managers:
        db1:
            connection: db1
            mappings:
                DionisDataBaseBundle: ~
        db2:
            connection: db2
            mappings:
                DionisDataBaseBundle: ~
        db3:
            connection: db2
            mappings:
                DionisDataBaseBundle: ~

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Sql convert to orm doctrine Symfony2

From Dev

Symfony2 Doctrine2 ManyToMany Composite key Column name referenced does not exist

From Dev

The association refers to the inverse side field which does not exist. | Symfony2 / Doctrine2

From Dev

Symfony2 - Doctrine exception: class used in the discriminator map does not exist

From Dev

Invalidating doctrine ORM cache in a rabbitmq-consumer | Symfony2

From Dev

Symfony2: Call to undefined method Doctrine\ORM\QueryBuilder::getResult()

From Dev

Symfony2: Call to undefined method Doctrine\ORM\QueryBuilder::getResult()

From Dev

No identifier specified error Symfony2 Doctrine ORM mapping

From Dev

Symfony2 Doctrine ORM cascade detach not working

From Dev

Variable does not exist in symfony2

From Dev

Bundle Does Not Exist: Symfony2

From Dev

DB2 database directory shows DB that does not exist

From Dev

Symfony2 Does Doctrine support "private/hidden" entity fields?

From Dev

sufficient page size does not exist - DB2 insert

From Dev

Cascaded persist not working (Doctrine ORM + Symfony 2)

From Dev

The annotation @Doctrine\ORM\Mapping in class xx does not exist, or cannot be loaded

From Dev

Symfony2 - Custom DQL Function Registered But Does Not Exist

From Dev

Symfony2 > MappingException: Class ...\Entity\User does not exist

From Dev

Symfony2 - Twig extension does not exist in Twig file

From Dev

Get form values in Symfony2 controller , Child does not exist

From Dev

Mapping Exception : Class does not exist Symfony2 Deployment

From Dev

Method "xxx" targeted by Callback constraint does not exist Symfony2

From Dev

Symfony2 gedmo SortablePosition annotation does not exist

From Dev

Symfony2 - Twig extension does not exist in Twig file

From Dev

Symfony2 gedmo SortablePosition annotation does not exist

From Dev

Symfony2 - Sonata Datagrid filter operators translation fails for doctrine_orm_class field

From Dev

What is the actual sense of .orm.yml files for doctrine in symfony2?

From Dev

Adding an "indirectly associated" entity as a member using Doctrine ORM annotations in Symfony2

From Dev

How to set Doctrine Auto Increment Starting Value @ORM\GeneratedValue[starts with 100] using symfony2

Related Related

  1. 1

    Sql convert to orm doctrine Symfony2

  2. 2

    Symfony2 Doctrine2 ManyToMany Composite key Column name referenced does not exist

  3. 3

    The association refers to the inverse side field which does not exist. | Symfony2 / Doctrine2

  4. 4

    Symfony2 - Doctrine exception: class used in the discriminator map does not exist

  5. 5

    Invalidating doctrine ORM cache in a rabbitmq-consumer | Symfony2

  6. 6

    Symfony2: Call to undefined method Doctrine\ORM\QueryBuilder::getResult()

  7. 7

    Symfony2: Call to undefined method Doctrine\ORM\QueryBuilder::getResult()

  8. 8

    No identifier specified error Symfony2 Doctrine ORM mapping

  9. 9

    Symfony2 Doctrine ORM cascade detach not working

  10. 10

    Variable does not exist in symfony2

  11. 11

    Bundle Does Not Exist: Symfony2

  12. 12

    DB2 database directory shows DB that does not exist

  13. 13

    Symfony2 Does Doctrine support "private/hidden" entity fields?

  14. 14

    sufficient page size does not exist - DB2 insert

  15. 15

    Cascaded persist not working (Doctrine ORM + Symfony 2)

  16. 16

    The annotation @Doctrine\ORM\Mapping in class xx does not exist, or cannot be loaded

  17. 17

    Symfony2 - Custom DQL Function Registered But Does Not Exist

  18. 18

    Symfony2 > MappingException: Class ...\Entity\User does not exist

  19. 19

    Symfony2 - Twig extension does not exist in Twig file

  20. 20

    Get form values in Symfony2 controller , Child does not exist

  21. 21

    Mapping Exception : Class does not exist Symfony2 Deployment

  22. 22

    Method "xxx" targeted by Callback constraint does not exist Symfony2

  23. 23

    Symfony2 gedmo SortablePosition annotation does not exist

  24. 24

    Symfony2 - Twig extension does not exist in Twig file

  25. 25

    Symfony2 gedmo SortablePosition annotation does not exist

  26. 26

    Symfony2 - Sonata Datagrid filter operators translation fails for doctrine_orm_class field

  27. 27

    What is the actual sense of .orm.yml files for doctrine in symfony2?

  28. 28

    Adding an "indirectly associated" entity as a member using Doctrine ORM annotations in Symfony2

  29. 29

    How to set Doctrine Auto Increment Starting Value @ORM\GeneratedValue[starts with 100] using symfony2

HotTag

Archive