Hi all,
I am having the following issue with my blog tutorial:
In my relations() method in the Post model I have the following relation declaration (copied directly from the tutorial):
return array(
'author'=>array(self::BELONGS_TO, 'User', 'authorId'),
'comments'=>array(self::HAS_MANY, 'Comment', 'postId',
'order'=>'comment.createTime'),
'tagFilter'=>array(self::MANY_MANY, 'Tag', 'PostTag(postId, tagId)',
'together'=>true,
'joinType'=>'INNER JOIN',
'condition'=>'??.name=:tag',
),
);
Yii does not recognize this part:
'order'=>'comment.createTime'),
and throws the following error:
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘comment.createTime’ in ‘order clause’
I can confirm that I have table name comment and there is createTime field in that table. However, if I change that line with the following it seems to work:
'order'=>'??.createTime'),
I saw these question marks used in another topic in this forum (not related to this problem) so decided to test it. Can someone explain how exactly Yii understands the question marks and how they should be used correctly?
I have no idea and hope that someone can help me understand why this is happening. Here is the rest of the error page: