Hi all,
I’ve just started using Yii 1.1 after my successfully finished Yii 1.0 based project.
My problem is that the eager load doesn’t work for me with yii 1.1 I’ve just started developing my new site, so I used everything generated by yiic.
I’ve got 2 tables:
TBUser
'userId' => 'User',
'name' => 'Name',
UserLogin
'TBUser_userId' => 'Tbuser User',
'perms' => 'Perms',
there is 1:1 relation between tables
TBUser model has this:
'userLogin' => array(self::HAS_ONE, 'UserLogin', 'TBUser_userId'),
UserLogin model:
'tBUser_user' => array(self::BELONGS_TO, 'TBUser', 'TBUser_userId'),
I’d like to get one row from both joined table, so I used this in UserIdentity.php at line 23:
23: $user = TBUser::model()->with(‘userLogin’)->find(“name LIKE BINARY '” . $this->username . “’”);
And I got this fatal error:
Invalid argument supplied for foreach()
Invalid argument supplied for foreach()
(/mnt/linmedia/www/yii1.1/framework/db/ar/CActiveFinder.php:727)
Stack trace:
#0 /mnt/linmedia/www/yii1.1/framework/db/ar/CActiveFinder.php(396):
CJoinElement->runQuery()
#1 /mnt/linmedia/www/yii1.1/framework/db/ar/CActiveFinder.php(73):
CJoinElement->find()
#2 /mnt/linmedia/www/yii1.1/framework/db/ar/CActiveFinder.php(91):
CActiveFinder->query()
#3 /mnt/linmedia/www/t4/protected/components/UserIdentity.php(23):
So what’s wrong with that query?