if ($uid && $tid) echo "&uid=$uid&tid=$tid";
else if ($uid) echo "&uid=$uid";
else if ($tid) echo "&tid=$tid";
else if ($cid) echo "&cid=$cid";
else if ($coid) echo "&coid=$coid";
else if ($rid) echo "&rid=$rid"
class YourService extends ContainerAware
{
public function switchDatabase($dbName, $dbUser, $dbPass)
{
$connection = $this->container->get(sprintf('doctrine.dbal.%s_connection', 'dynamic_conn'));
$connection->close(); // for sure ;)
$refConn = new \ReflectionObject($connection);
$refParams = $refConn->getProperty('_params');
$refParams->setAccessible('public'); //we have to change it for a moment
$params = $refParams->getValue($connection);
$params['dbname'] = $dbName;
$params['user'] = $dbUser;
$params['password'] = $dbPass;
$refParams->setAccessible('private');
$refParams->setValue($connection, $params);
$this->container->get('doctrine')->resetEntityMamager('dynamic_manager'); // for sure (unless you like broken transactions)
}
}
global $Page, $db;