framework/db/ActiveQuery.php
protected function getTableNameAndAlias()
    {
        if (empty($this->from)) {
            $tableName = $this->getPrimaryTableName();
        } else {
            $tableName = '';
            // if the first entry in "from" is an alias-tablename-pair return it directly
            foreach ($this->from as $alias => $tableName) {
                if (is_string($alias)) {
                    return [$tableName, $alias];
                }
                break;
            }
        }

        if (preg_match('/^(.*?)\s+({{\w+}}|\w+)$/', $tableName, $matches)) {
            $alias = $matches[2];
        } else {
            $alias = $tableName;
        }

        return [$tableName, $alias];
    }
protected function getTableNameAndAlias()
    {
        if (empty($this->from)) {
            $tableName = $this->getPrimaryTableName();
        } else {
            $tableName = '';
            // if the first entry in "from" is an alias-tablename-pair return it directly
            foreach ($this->from as $alias => $tableName) {
                if (is_string($alias)) {
                    return [$tableName, $alias];
                }
                break;
            }
        }

        if (preg_match('/^(.*?)\s+({{\w+}}|\w+)$/', $tableName, $matches)) {
            $alias = $matches[2];
        } else {
            $alias = $tableName;
        }

        return [$tableName, $alias];
    }
protected function getTableNameAndAlias ( ) { if ( empty ( $ this -> from ) ) { $ tableName = $ this -> getPrimaryTableName ( ) ; } else { $ tableName = '' ; // if the first entry in "from" is an alias-tablename-pair return it directly foreach ( $ this -> from as $ alias => $ tableName ) { if ( is_string ( $ alias ) ) { return [ $ tableName , $ alias ] ; } break ; } } if ( preg_match ( '/^(.*?)\s+({{\w+}}|\w+)$/' , $ tableName , $ matches ) ) { $ alias = $ matches [ 2 ] ; } else { $ alias = $ tableName ; } return [ $ tableName , $ alias ] ; }
Returns the table name and the table alias for [[modelClass]].
@return array the table name and the table alias.
@since 2.0.16
Returns the table name and the table alias for [[ modelClass ]] .