How do you avoid duplicate alias with calling a relation more than once?

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.

I’m having the same sort of issue, I’m not sure it’s entirely possible. You can specify an alias for each relation, but this is set when the class it loaded, so even specifying a random alias will result in the same random alias being used for both joins.

Did you find a solution to this?