// Make sure $alias isn't already used; if it, start adding stuff.
$alias_base =
$alias;
$count = 1;
while (!
empty($this->relationships
[$alias])) { $alias =
$alias_base . '_' .
$count++;
} // Make sure this join is adjusted for our relationship.
if ($link_point &&
isset($this->relationships
[$link_point])) { $join =
$this->
adjustJoin($join,
$link_point);
} // Add the table directly to the queue to avoid accidentally marking
// it.
$this->tableQueue
[$alias] =
[ 'table' =>
$join->table,
'num' => 1,
'alias' =>
$alias,
'join' =>
$join,
'relationship' =>
$link_point,
];