Zend Framework

Zend_Db_Select::columns with $correlationName = null

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: None
  • Labels:
    None

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);
    }

Issue Links

Activity

Hide
Martin Mayer added a comment -

ZF-5830 is already opened for this.

Show
Martin Mayer added a comment - ZF-5830 is already opened for this.
Hide
Satoru Yoshida added a comment -

Thank you for comment of duplication.

Show
Satoru Yoshida added a comment - Thank you for comment of duplication.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: