I am having very difficult time to select usernames of all posts in the blog demo given in Yii…
author is relation of post class with user…
$criteria = new CDbCriteria;
$dataProvider=new CActiveDataProvider(‘Post’, array(
‘criteria’ => $criteria,
Active record "Post" is trying to select an invalid column "author.username". Note, the column must exist in the table or be an expression with alias.
Please plese someone help me…its urgent…
I had same problem,
look here Select problem CDbCriteria with join and select
I think correct is
$criteria->with = array("author"=>array("select"=>"id,username"));
Thanks! You save me a lot of time!!!
total life saver!!!!! Thanks!