ZF-5985: Zend_Db_Select::columns with $correlationName = null

Description

The method columns should provide the default table name when not specified. For example

// Zend_Db_Table_Abstract $table; 

$table->select->columns(array('foo', 'bar')); 

should be equivalent to

$table->select()->from($table->info(Zend_Db_Table::NAME), array('foo', 'bar'));

Since $table->select(); create a new Zend_Db_Select, it should set the default table to use when invoking methods that sets colums and such when not specified. For now, the first statement will cause a 'No table has been specified for the FROM clause' exception.

A solution would be to change the Zend_Db_Table_Abstract::select() method to :

    public function select()
    {
        require_once 'Zend/Db/Table/Select.php';
        $select = new Zend_Db_Table_Select($this);
        return $select->from($this->_name);
    }

Comments

ZF-5830 is already opened for this.

Thank you for comment of duplication.