Hello
I have:
class myModel extends ActiveRecord {
...
public function relations()
{
return array(
'children' => array(self::HAS_MANY, 'myModel', 'parent_id'),
);
}
}
I am then trying to call:
myModel::model()->with('children.children')->find();
This gives me the error:
Duplicate alias: 7 ERROR: table name "children" specified more than once.
I assume this is because ActiveRecord uses the relation name as the alias, and as it’s appearing twice, I am getting this error. I have tried adding:
'alias' => $this->getTableAlias()
to the relation, but the same error occurs only citing the table name as "t".
Can anyone advise on how to use rectify this? Thanks.