php - Cross Database Joins Doctrine -


i have 2 connection in doctrine zf2, need make join in twoo databases. big question is: possible perform join on 2 tables in different databases , connections?

'connection' => array(             // default db connection            'orm_default' => array(                 'driverclass' => 'doctrine\dbal\driver\pdomysql\driver',                 'params' => array(                     'host' => 'localhost',                     'user' => 'root',                     'port' => '3306',                     'password' => '',                     'dbname' => 'mysql_test',                     'driveroptions' => array(                         pdo::mysql_attr_init_command => "set names 'utf8'"                     )                 ),             ),              // alternative db connection             'orm_alternative' => array(                 'driverclass' => 'doctrine\dbal\driver\pdosqlsrv\driver',                 'params' => array(                     'host' => 'localhost',                     'user' => 'sa',                     'port' => '',                     'password' => 'test',                     'dbname' => 'mssql_test',                 ),             ),         ), 

entity mysql example:

   /**      * mysql_test      *      * @orm\table(name="mysql_table")      * @orm\entity      * @orm\haslifecyclecallbacks      * @orm\entity(repositoryclass="mysql\entity\testrepository")      */     class test     {         /**          * @var integer          *          * @orm\column(name="id", type="integer", nullable=false)          * @orm\id          * @orm\generatedvalue(strategy="identity")          */         private $id;           /**          * @orm\onetoone(targetentity="mssql\entity\test")          * @orm\joincolumn(name="id_mssql", referencedcolumnname="id_mssql")          */         private $mssql; 

i make join between these 2 connections :(

short answer looking is, unfortunately, no.

there ways 2 separate connections (mysql , mssql in case) share data , this post might lead down right track if feeling adventurous.

but recommend selecting data each connection separately , manipulating in php matching common keys each result emulate join.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -