Consider the following SQL query:
$sql = "
SELECT t1.id, t1.task, t1.description t2.staffid, t3.fullname
FROM table_1 AS t1
JOIN table_2 AS t2 ON t1.id = t2.id
JOIN `external_db`.table AS t3 ON t2.staffid = t3.staffid
";
and I run
$cmd = Yii::app()->db->createCommand($sql)->setFetchMode(PDO::FETCH_OBJ);
Is it possible to accomplish this via Yii’s with() method? I cannot seem to get it working using multiple databases, even though I have extended CActiveRecord to handle multiple database connections, I still get the error:
Database1.t3 not found in Database1
Any thoughts?