Zend_Db_Table_Select::from PHP Method

from() public method

The table name can be expressed
public from ( array | string | Zend_Db_Expr | Zend_Db_Table_Abstract $name, array | string | Zend_Db_Expr $cols = self::SQL_WILDCARD, string $schema = null ) : Zend_Db_Table_Select
$name array | string | Zend_Db_Expr | Zend_Db_Table_Abstract The table name or an associative array relating table name to correlation name.
$cols array | string | Zend_Db_Expr The columns to select from this table.
$schema string The schema name to specify, if any.
return Zend_Db_Table_Select This Zend_Db_Table_Select object.
    public function from($name, $cols = self::SQL_WILDCARD, $schema = null)
    {
        if ($name instanceof Zend_Db_Table_Abstract) {
            $info = $name->info();
            $name = $info[Zend_Db_Table_Abstract::NAME];
            if (isset($info[Zend_Db_Table_Abstract::SCHEMA])) {
                $schema = $info[Zend_Db_Table_Abstract::SCHEMA];
            }
        }
        return $this->joinInner($name, null, $cols, $schema);
    }

Usage Example

Example #1
0
 public function onStatistics($event)
 {
     $table = Engine_Api::_()->getDbTable('playlists', 'music');
     $select = new Zend_Db_Table_Select($table);
     $select->from($table->info('name'), array('COUNT(*) AS count'));
     $event->addResponse($select->query()->fetchColumn(0), 'playlist');
     $table = Engine_Api::_()->getDbTable('playlistSongs', 'music');
     $select = new Zend_Db_Table_Select($table);
     $select->from($table->info('name'), array('COUNT(*) AS count'));
     $event->addResponse($select->query()->fetchColumn(0), 'song');
 }
All Usage Examples Of Zend_Db_Table_Select::from