public function join(Table $table, $joined_table_column, $column, $criteria = [], $join_type = Join::LEFT, $on_table = null)
        {
            if (!$this->table instanceof Table) {
                throw new Exception('Cannot use ' . $this->table . ' as a table. You need to call setTable() before trying to join a new table');
            }

            if (!$table instanceof Table) {
                throw new Exception('Cannot join table ' . $table . ' since it is not a table');
            }

            foreach ($this->joins as $join) {
                if ($join->getTable()->getB2DBAlias() === $table->getB2DBAlias()) {
                    $table = clone $table;
                    break;
                }
            }

            $left_column = $table->getB2DBAlias() . '.' . Table::getColumnName($joined_table_column);
            $join_on_table = $on_table ?? $this->table;
            $right_column = $join_on_table->getB2DBAlias() . '.' . Table::getColumnName($column);

            $this->joins[$table->getB2DBAlias()] = new Join($table, $left_column, $right_column, $this->getRealColumnName($column), $criteria, $join_type);

            return $table;
        }