src/Query.php
public function getSelectionColumn($column)
        {
            if (isset($this->selections[$column])) {
                return $this->selections[$column]->getColumn();
            }

            foreach ($this->selections as $selection) {
                if ($selection->getAlias() == $column) {
                    return $column;
                }
            }

            list($table_name, $column_name) = (strpos($column, '.') !== false) ? explode('.', $column) : [$this->table->getB2DBName(), $column];

            if ($this->table->getB2DBAlias() == $table_name || $this->table->getB2DBName() == $table_name) {
                return $this->table->getB2DBAlias() . '.' . $column_name;
            } elseif (isset($this->joins[$table_name])) {
                return $this->joins[$table_name]->getTable()->getB2DBAlias() . '.' . $column_name;
            }

            foreach ($this->joins as $join) {
                if ($join->getTable()->getB2DBName() == $table_name) {
                    return $join->getTable()->getB2DBAlias() . '.' . $column_name;
                }
            }

            throw new Exception("Couldn't find table name '{$table_name}' for column '{$column_name}', column was '{$column}'. If this is a column from a foreign table, make sure the foreign table is joined.");
        }
public function getSelectionColumn($column)
        {
            if (isset($this->selections[$column])) {
                return $this->selections[$column]->getColumn();
            }

            foreach ($this->selections as $selection) {
                if ($selection->getAlias() == $column) {
                    return $column;
                }
            }

            list($table_name, $column_name) = (strpos($column, '.') !== false) ? explode('.', $column) : [$this->table->getB2DBName(), $column];

            if ($this->table->getB2DBAlias() == $table_name || $this->table->getB2DBName() == $table_name) {
                return $this->table->getB2DBAlias() . '.' . $column_name;
            } elseif (isset($this->joins[$table_name])) {
                return $this->joins[$table_name]->getTable()->getB2DBAlias() . '.' . $column_name;
            }

            foreach ($this->joins as $join) {
                if ($join->getTable()->getB2DBName() == $table_name) {
                    return $join->getTable()->getB2DBAlias() . '.' . $column_name;
                }
            }

            throw new Exception("Couldn't find table name '{$table_name}' for column '{$column_name}', column was '{$column}'. If this is a column from a foreign table, make sure the foreign table is joined.");
        }
public function getSelectionColumn ( $ column ) { if ( isset ( $ this -> selections [ $ column ] ) ) { return $ this -> selections [ $ column ] -> getColumn ( ) ; } foreach ( $ this -> selections as $ selection ) { if ( $ selection -> getAlias ( ) == $ column ) { return $ column ; } } list ( $ table_name , $ column_name ) = ( strpos ( $ column , '.' ) !== false ) ? explode ( '.' , $ column ) : [ $ this -> table -> getB2DBName ( ) , $ column ] ; if ( $ this -> table -> getB2DBAlias ( ) == $ table_name || $ this -> table -> getB2DBName ( ) == $ table_name ) { return $ this -> table -> getB2DBAlias ( ) . '.' . $ column_name ; } elseif ( isset ( $ this -> joins [ $ table_name ] ) ) { return $ this -> joins [ $ table_name ] -> getTable ( ) -> getB2DBAlias ( ) . '.' . $ column_name ; } foreach ( $ this -> joins as $ join ) { if ( $ join -> getTable ( ) -> getB2DBName ( ) == $ table_name ) { return $ join -> getTable ( ) -> getB2DBAlias ( ) . '.' . $ column_name ; } } throw new Exception ( "Couldn't find table name '{$table_name}' for column '{$column_name}', column was '{$column}'. If this is a column from a foreign table, make sure the foreign table is joined." ) ; }
Return a select column

@param string $column

@return string
Return a select column