src/Query/Clause/OrderBy.php
public function _UpdateQueryBuilder(Builder $objBuilder)
    {
        $intLength = count($this->objNodeArray);
        for ($intIndex = 0; $intIndex < $intLength; $intIndex++) {
            $objNode = $this->objNodeArray[$intIndex];
            if ($objNode instanceof Node\Virtual) {
                if ($objNode->hasSubquery()) {
                    throw new Caller('You cannot define a virtual node in an order by clause. You must use an Expand clause to define it.');
                }
                $strOrderByCommand = '__' . $objNode->getAttributeName();
            } elseif ($objNode instanceof Node\Column) {
                /** @var Node\Column $objNode */
                $strOrderByCommand = $objNode->getColumnAlias($objBuilder);
            } elseif ($objNode instanceof iCondition) {
                /** @var iCondition $objNode */
                $strOrderByCommand = $objNode->getWhereClause($objBuilder);
            } else {
                $strOrderByCommand = '';
            }

            // Check to see if they want a ASC/DESC declarator
            if ((($intIndex + 1) < $intLength) &&
                !($this->objNodeArray[$intIndex + 1] instanceof Node\NodeBase)
            ) {
                if ((!$this->objNodeArray[$intIndex + 1]) ||
                    (trim(strtolower($this->objNodeArray[$intIndex + 1])) == 'desc')
                ) {
                    $strOrderByCommand .= ' DESC';
                } else {
                    $strOrderByCommand .= ' ASC';
                }
                $intIndex++;
            }

            $objBuilder->addOrderByItem($strOrderByCommand);
        }
    }
public function _UpdateQueryBuilder(Builder $objBuilder)
    {
        $intLength = count($this->objNodeArray);
        for ($intIndex = 0; $intIndex < $intLength; $intIndex++) {
            $objNode = $this->objNodeArray[$intIndex];
            if ($objNode instanceof Node\Virtual) {
                if ($objNode->hasSubquery()) {
                    throw new Caller('You cannot define a virtual node in an order by clause. You must use an Expand clause to define it.');
                }
                $strOrderByCommand = '__' . $objNode->getAttributeName();
            } elseif ($objNode instanceof Node\Column) {
                /** @var Node\Column $objNode */
                $strOrderByCommand = $objNode->getColumnAlias($objBuilder);
            } elseif ($objNode instanceof iCondition) {
                /** @var iCondition $objNode */
                $strOrderByCommand = $objNode->getWhereClause($objBuilder);
            } else {
                $strOrderByCommand = '';
            }

            // Check to see if they want a ASC/DESC declarator
            if ((($intIndex + 1) < $intLength) &&
                !($this->objNodeArray[$intIndex + 1] instanceof Node\NodeBase)
            ) {
                if ((!$this->objNodeArray[$intIndex + 1]) ||
                    (trim(strtolower($this->objNodeArray[$intIndex + 1])) == 'desc')
                ) {
                    $strOrderByCommand .= ' DESC';
                } else {
                    $strOrderByCommand .= ' ASC';
                }
                $intIndex++;
            }

            $objBuilder->addOrderByItem($strOrderByCommand);
        }
    }
public function _UpdateQueryBuilder ( Builder $ objBuilder ) { $ intLength = count ( $ this -> objNodeArray ) ; for ( $ intIndex = 0 ; $ intIndex < $ intLength ; $ intIndex ++ ) { $ objNode = $ this -> objNodeArray [ $ intIndex ] ; if ( $ objNode instanceof Node \ Virtual ) { if ( $ objNode -> hasSubquery ( ) ) { throw new Caller ( 'You cannot define a virtual node in an order by clause. You must use an Expand clause to define it.' ) ; } $ strOrderByCommand = '__' . $ objNode -> getAttributeName ( ) ; } elseif ( $ objNode instanceof Node \ Column ) { /** @var Node\Column $objNode */ $ strOrderByCommand = $ objNode -> getColumnAlias ( $ objBuilder ) ; } elseif ( $ objNode instanceof iCondition ) { /** @var iCondition $objNode */ $ strOrderByCommand = $ objNode -> getWhereClause ( $ objBuilder ) ; } else { $ strOrderByCommand = '' ; } // Check to see if they want a ASC/DESC declarator if ( ( ( $ intIndex + 1 ) < $ intLength ) && ! ( $ this -> objNodeArray [ $ intIndex + 1 ] instanceof Node \ NodeBase ) ) { if ( ( ! $ this -> objNodeArray [ $ intIndex + 1 ] ) || ( trim ( strtolower ( $ this -> objNodeArray [ $ intIndex + 1 ] ) ) == 'desc' ) ) { $ strOrderByCommand .= ' DESC' ; } else { $ strOrderByCommand .= ' ASC' ; } $ intIndex ++ ; } $ objBuilder -> addOrderByItem ( $ strOrderByCommand ) ; } }
Updates the query builder according to this clause. This is called by the query builder only.

@param Builder $objBuilder
@throws Caller
Updates the query builder according to this clause . This is called by the query builder only .