Reputation: 5406
This fails when I use $currentUser->id in my CollectionController.php
$criteria = new CDbCriteria();
$criteria->condition = 'tbl_userId=:tbl_userId';
$criteria->params = array(':tbl_userId' =>$currentUser->id);
$dataProvider=new CActiveDataProvider('Collection', array('criteria'=>$criteria));
But if I just plug a literal in the params array my query comes back correct.
$criteria = new CDbCriteria();
$criteria->condition = 'tbl_userId=:tbl_userId';
$criteria->params = array(':tbl_userId' => 12);
$dataProvider=new CActiveDataProvider('Collection', array('criteria'=>$criteria));
What's the quickest Yii-way to verify my var? $currentUser->id
I'm new to PHP / Yii... Thanks for your help.
Upvotes: 0
Views: 61
Reputation: 5039
echo out $currentUSer->id
from the controller. Don't execute the query that is failing and the view should render with what $currentUser->id is. Nothing Yii style, but it's a quick way to find out what if anything the $currentUser is returning
Upvotes: 1