/** * Add all available foreign tables * * @param array $join [optional] */ public function setupJoinTables($join = 'all') { if (!is_array($join) && $join == 'all') { $foreign_tables = $this->fromtable->getForeignTables(); foreach ($foreign_tables as $aForeign) { $fTable = array_shift($aForeign); $fKey = $fTable->getB2DBAlias() . '.' . $this->getColumnName(array_shift($aForeign)); $fColumn = $this->fromtable->getB2DBAlias() . '.' . $this->getColumnName(array_shift($aForeign)); $this->addJoin($fTable, $fKey, $fColumn); } } elseif (is_array($join)) { foreach ($join as $join_column) { $foreign = $this->fromtable->getForeignTableByLocalColumn($join_column); $this->addJoin($foreign['table'], $foreign['table']->getB2DBAlias() . '.' . $this->getColumnName($foreign['key']), $this->fromtable->getB2DBAlias() . '.' . $this->getColumnName($foreign['column'])); } } }