Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8185989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:02:52+00:00 2026-06-07T02:02:52+00:00

I have two connection of database in config.yml: doctrine: dbal: default_connection: default connections: default:

  • 0

I have two connection of database in config.yml:

doctrine:
dbal:
    default_connection: default
    connections:
        default:
            host:     %database_host%
            port:     %database_port%
            dbname:   %database_name%
            user:     %database_user%
            password: %database_password%
            driver:   %database_driver%
            charset:  UTF8
        spoop:
            host:     %database_host%
            port:     %database_port%
            dbname:   %spoop_database_name%
            user:     %spoop_database_user%
            password: %spoop_database_password%              
            driver:   %database_driver%
            charset:  UTF8

orm:
    default_entity_manager:   default
    entity_managers:
        default:
            connection:       default
            #metadata_cache_driver: apc
            #query_cache_driver: apc
            #result_cache_driver: apc
            mappings:
                AcmeUserBundle: ~
                AcmeBannieresBundle: ~
                FOSUserBundle: ~
                #SpoopAdminBundle: ~
        spoop:
            connection:       spoop
            #metadata_cache_driver: apc
            #query_cache_driver: apc
            #result_cache_driver: apc
            mappings:
                AcmeModerationBundle: ~

    auto_generate_proxy_classes: %kernel.debug%  

so in my acmeModerationBundle, i use the spoop connection. I have a formtype like this in Acme\ModerationBundle\Form:

    class ModerationAnnonceForm extends AbstractType{
        public function buildForm(FormBuilder $builder, array $options)
        {
            $builder
            ->add('descAnnonce')
            ->add('idRubrique','entity',array(
                    'class' => 'AcmeModerationBundle:TRubrique',
                    'expanded'=>true,
                    'multiple' =>false,
            ));
        }
        public function getDefaultOptions(array $options)
        {
            return array(
                'data_class' => 'Acme\ModerationBundle\Entity\TAnnonces',
            );
        }
        public function getName()
        {
            return 'acme_moderationbundle_annonceform';
        }
    }

the AcmeModerationBundle:TRubrique is defined in the proper place : Acme/Moderationbundle/Entity/TRubrique. When i trying to generate this form, i always get this:
Unknown Entity namespace alias ‘AcmeModerationBundle’. I take a look in the log,

    at ORMException ::unknownEntityNamespace ('AcmeModerationBundle')
    in D:\workspace\symfony_bannieres\vendor\doctrine\lib\Doctrine\ORM\Configuration.php at line 174  -+
    at Configuration ->getEntityNamespace ('AcmeModerationBundle')
    in D:\workspace\symfony_bannieres\vendor\doctrine\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php at line 156  -+
    at ClassMetadataFactory ->getMetadataFor ('AcmeModerationBundle:TRubrique')
    in D:\workspace\symfony_bannieres\vendor\doctrine\lib\Doctrine\ORM\EntityManager.php at line 257  -+
    at EntityManager ->getClassMetadata ('AcmeModerationBundle:TRubrique')
    in D:\workspace\symfony_bannieres\vendor\symfony\src\Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList.php at line 113  -+
    at EntityChoiceList ->__construct (object(EntityManager), 'AcmeModerationBundle:TRubrique', null, null, null)
    in D:\workspace\symfony_bannieres\vendor\symfony\src\Symfony\Bridge\Doctrine\Form\Type\EntityType.php at line 62  -+

    at EntityType ->getDefaultOptions (array('class' => 'AcmeModerationBundle:TRubrique', 'expanded' => true, 'multiple' => false, 'data' => null))
    in D:\workspace\symfony_bannieres\vendor\symfony\src\Symfony\Component\Form\FormFactory.php at line 234  -

i suppose it use the default entity manager, i check the php app/console container:debug

    doctrine.orm.default_entity_manager           container Doctrine\ORM\EntityManager
    doctrine.orm.entity_manager                   n/a       alias for doctrine.orm.default_entity_manager
    doctrine.orm.spoop_entity_manager             container Doctrine\ORM\EntityManager

Anyone can tell me what’s wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:02:53+00:00Added an answer on June 7, 2026 at 2:02 am

    The entity field type accepts an em option which lets you specify the entity manager

    <?php
    
    class ModerationAnnonceForm extends AbstractType
    {
        public function buildForm(FormBuilder $builder, array $options)
        {
            $builder
            ->add('descAnnonce')
            ->add('idRubrique','entity',array(
                    'class' => 'AcmeModerationBundle:TRubrique',
                    'em' => 'spoop' // Add this
                    'expanded'=>true,
                    'multiple' =>false,
            ));
        }
    
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine
I have two separate processes, each with it's own database connection, inserting product records
we have two different environments (test and production), each with it's own database connection.
I have two php files, one manages database connection and the other retrieves data
I have two options to configure my application database connection - one is using
I have two databases named: DB_A and DB_B . Each database has one collection
I have long-lasting TCP connection between two computers (second not under my control). Second
Say, I have two computers behind firewalls, routers, etc (ie. no incoming connections). Is
I have table with two columns (varchar from, varchar to). This table represents connections
I'm trying to run an NHibernate over sqlite. i have two projects: 1. Orange.Database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.