I'd like to connect two models that are in different databases using models and builder.
I'm using phalcon 1.3.4 and i have in example db A(table Invoices) and db B (table logs).
Now I'm trying to get data from db B someyhing like this :
$logs = $this->di->get('modelsManager')
->createBuilder()
->columns(
array(
'log.code',
'inv.codeA',
'log.request',
'log.response',
'inv.createdAt'
)
)
->addFrom('App\Model\Logs', 'log')
->leftJoin('App\Model\Invoices', 'inv.code = log.code', 'inv')
->getQuery()
->execute();
And it keeps trying to join table invoices that is defined in db A. And keep geting
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'B.invoices' doesn't exist
I can join those tables in plain sql, probably rawSql approach would solve it but I'm wondering if it's possible doing models?