I’m not sure what is suitable title for this thread. but I think the problem is about Alias Table in ActiveRecord
So here is the problem (I Attached the screenhoot Error1.png)
my source code is like this:
public function findRecentPosts($limit=10)
{
$criteria=array(
'condition'=>'Post.status='.self::STATUS_PUBLISHED,
'order'=>'Post.createTime DESC',
'limit'=>$limit,
);
return $this->findAll($criteria);
}
I have tried to change all of Post.{fieldname} into t.{fieldname}, therefore become like this, and it works:
public function findRecentPosts($limit=10)
{
$criteria=array(
'condition'=>'t.status='.self::STATUS_PUBLISHED,
'order'=>'t.createTime DESC',
'limit'=>$limit,
);
return $this->findAll($criteria);
}
BUT, when I work with multiple models that involving another Model that has same field I getting the same error. therefore changing table name into "t" is not resolving all problems, even emerging another problem.
The default alias is the name of your relation. So in your case instead of ‘??’ use ‘tagFilter’. If i remember well, ‘??’ was the alias used in Yii 1.0.x.