symfony1 - Temporary Connection to External Database with Symfony/Doctrine -


summary:

To capture some essential things, I run a query against an external database I want to be able to have the data that the user logs in. I do not want this site to be anything for a long period with other external databases, it may be necessary to be able to push data back, but in particular, Do not want to try to create a schema, he should leave alone alone and allow connection from time to time. / P>

Description:

I am trying to make a temporary connection to the database of another Symphonic application and I do not seem to understand how to do it.

I have an existing symphony site that is set up and running. I am trying to create a kind of management system for users of this main site. In the management system, there will be separate deployment for each user who is involved in it, so it will also have its own database attached to it. However, this management system needs access to 2 or 3 tables from the main site system.

I have tried to add different entries to the database in the management system to make connections with both the databases, but whenever I want to keep all my composition in both databases.

The best that I have considered is giving the connection: Management, and connections are also organized in all my tables for the management system: all in the main_site table from the main site, however, in the management system And on the main site, yml files will need to be maintained so that they can be sure that they are running with each other.

I hope this was a little too obvious.

Thanks for help: D

Ability to use a DQL Without a temporary connection to a remote site, simply Doctrine_Manager :

  $ conn = Doctrine_Manager :: getInstance () - & gt; OpenConnection ('mysql: // username: password @ localhost / database', 'connection2', incorrect);  

Make sure that the third argument is false, so this does not make the current connection. You can then run a question on the connection using PDO:

  $ conn-> Exec ('SELECT * to table WHERE conditon =?', Array ('value'));  

If you want to be able to use DQL and remote schema, you have to do it in the manner you specify: define two connections and maintain schema in both places. (Your version control should be able to handle this).


Comments