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 8068961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:51:30+00:00 2026-06-05T12:51:30+00:00

I have an app that talks to two different databases. For one of my

  • 0

I have an app that talks to two different databases. For one of my entities, School, I get the following error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pressbox.schools' doesn't exist

That makes sense because there is no pressbox.schools. It’s fnt.schools. It’s trying to talk to the wrong database.

How do I tell my entity which mapping I want it to use? I would of course rather refer to the mappings than to the database names themselves, which can be different depending on the environment.

  • 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-05T12:51:32+00:00Added an answer on June 5, 2026 at 12:51 pm

    First, declare your connections in a config file (config.yml would be fine):

    doctrine:
      dbal:
        default_connection: pressbox # change it as you wish
        connections:
          pressbox:
            driver:   %database_driver%
            host:     %database_host%
            port:     %database_port%
            dbname:   pressbox
            user:     pressbox_usr
            password: pressbox_pwd
            charset:  UTF8
          fnt:
            driver:   %database_driver%
            host:     %database_host%
            port:     %database_port%
            dbname:   fnt
            user:     fnt_usr
            password: fnt_pwd
            charset:  UTF8
    

    Then declare the entity managers:

    doctrine:
      orm:
        default_entity_manager: pressbox
        entity_managers:
          pressbox:
            connection: web
          fnt:
            connection: fnt
    

    Now, in a controller, you can tell Doctrine which entity manager to use by passing its name to getEntityManager():

    $fntEm = $this->getDoctrine()->getEntityManager('fnt');
    

    Assuming the entity manager for the fnt table is called that same name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that has a centre view with two views off to
My situation is that I have a universal app that talks to an sql
I have a app that uses a classic email like layout like the one
I have two servers: one running a django app and one running both a
I have a .NET Winform Click-Once-deployed fat client that talks to three databases, 2
I have a basic queue of tasks executing (c# WinForms App that talks to
I have two applications that need to talk to each other over HTTP. One
I have an app that is a list of tasks, like a to do
I have a silverlight application that needs to talk to a rails app to
have an app that finds your GPS location successfully, but I need to be

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.