It seems to me that using Doctrines ODM is not the right way to approach this. You can still use Doctrine to connect to databases and query them. But if you have no entity classes the use of an entity manager seems to be inappropriate.
Use Doctrine for Connection handling
Here is how you create a connection to a Database with the doctrine Connection
class:
/** @var \Doctrine\Bundle\DoctrineBundle\ConnectionFactory $connectionFactory */
$connectionFactory = $this->getContainer()->get('doctrine.dbal.connection_factory');
$connection = $connectionFactory->createConnection(
array('pdo' => new \PDO("mysql:host=$hostname;dbname=$dbname", $username, $password))
);
Now you can use $connection
as a simple PDO
object:
$connection->executeQuery('SELECT * FROM your_table');
You could add this code as a service to make it accessible everywhere.
If you want to connect to a different database for a different domain you can use this code to identify the domain:
$this->getRequest()->getHost();
To access the domain in an action do this:
public function yourAction(Request $request, /* ... */)
{
// the Controller extends the Container. So need to get it here:
$connectionFactory = $this->get('doctrine.dbal.connection_factory');
// also access the domain like this:
$domain = $request->getHost();
}