Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Error Trying To Get Table In Multiple Db Relation With Cdbcriteria

$
0
0
Hello to everyone, this is my first post here, I read the forum rules so I hope getting this right.

In a project I have a multiple DB configuration following the steps of the wiki: Multiple Databases and Multiple Domains

Actually it works great (and have more than 4 DB), even I can write this in the view a column of a CGridView:
  array('name'=>'ColumnName','value'=>'$data->rel1->rel2->rel3->columnName'),

Where rel3 is in another DB.

My problem is when I want to order some data when creating a CActiveDataProvider:
$valDataProvider =new CActiveDataProvider('Class1',array(
                            'criteria'=>array('with'  => array('relClass1',relClass1.relClass2'
                                                              ),
                                              'together'=>true,
                                              'order' => 'relClass1.relClass2.columnName DESC',
                                              )
                        ));


This gets me the error :
CDbCommand falló al ejecutar la sentencia SQL: SQLSTATE[HY000] [-1] Invalid object name 'dbo.table1'.

Translated it says:
CDbCommand failed to execute the SQL Query: SQL:SQLSTATE[HY000] [-1] Invalid object name 'dbo.table1'


Now for what I have discovered, can't find the DB table (because is searching in DB1 instead of DB2).

I searched in Yii code but actually I just suppose that happens two things:
  • I did something wrong
  • Yii is generating a bad sql query


I hope I have make my problem clear and I would really appreciate a little bit of help, thank you everyone

Extra Info:
Yii version : 1.1.10
DB Manager : Microsoft SQL Server 2008

Viewing all articles
Browse latest Browse all 18717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>