Library/Bullhorn/FastRest/Api/Services/ControllerHelper/Index.php
private function buildSortRecursive(ApiInterface $entity, $parts, $isAsc, &$orderBy, $alias = null) {
        if(is_null($alias)) {
            $alias = get_class($entity);
        }
        $part = array_shift($parts);
        if(sizeOf($parts) == 0) { //Is Last part
            if(in_array($part, $entity->getModelsMetaData()->getColumnMap($entity))) {
                if($orderBy != '') {
                    $orderBy .= ',';
                }
                $orderBy .= $alias . '.' . $part . ' ' . ($isAsc ? 'ASC' : 'DESC');
            } else {
                throw new Exception('Could Not Find sort part: ' . $part, 400);
            }
        } else {
            $subAlias = ucfirst($part);
            $subEntity = $this->addJoin($entity, $subAlias, true); //Throws an exception if not found
            $this->buildSortRecursive($subEntity, $parts, $isAsc, $orderBy, $subAlias);
        }
    }
private function buildSortRecursive(ApiInterface $entity, $parts, $isAsc, &$orderBy, $alias = null) {
        if(is_null($alias)) {
            $alias = get_class($entity);
        }
        $part = array_shift($parts);
        if(sizeOf($parts) == 0) { //Is Last part
            if(in_array($part, $entity->getModelsMetaData()->getColumnMap($entity))) {
                if($orderBy != '') {
                    $orderBy .= ',';
                }
                $orderBy .= $alias . '.' . $part . ' ' . ($isAsc ? 'ASC' : 'DESC');
            } else {
                throw new Exception('Could Not Find sort part: ' . $part, 400);
            }
        } else {
            $subAlias = ucfirst($part);
            $subEntity = $this->addJoin($entity, $subAlias, true); //Throws an exception if not found
            $this->buildSortRecursive($subEntity, $parts, $isAsc, $orderBy, $subAlias);
        }
    }
private function buildSortRecursive ( ApiInterface $ entity , $ parts , $ isAsc , & $ orderBy , $ alias = null ) { if ( is_null ( $ alias ) ) { $ alias = get_class ( $ entity ) ; } $ part = array_shift ( $ parts ) ; if ( sizeOf ( $ parts ) == 0 ) { //Is Last part if ( in_array ( $ part , $ entity -> getModelsMetaData ( ) -> getColumnMap ( $ entity ) ) ) { if ( $ orderBy != '' ) { $ orderBy .= ',' ; } $ orderBy .= $ alias . '.' . $ part . ' ' . ( $ isAsc ? 'ASC' : 'DESC' ) ; } else { throw new Exception ( 'Could Not Find sort part: ' . $ part , 400 ) ; } } else { $ subAlias = ucfirst ( $ part ) ; $ subEntity = $ this -> addJoin ( $ entity , $ subAlias , true ) ; //Throws an exception if not found $ this -> buildSortRecursive ( $ subEntity , $ parts , $ isAsc , $ orderBy , $ subAlias ) ; } }
Builds the order by

@param ApiInterface $entity
@param string[] $parts
@param bool $isAsc
@param string &$orderBy
@param string $alias

@return void
@throws Exception
Builds the order by