public function getSort($format = 'native')
    {
        if (!is_null($this->suppliedSort)) {
            $nativeSort = $this->suppliedSort;
        } elseif (!is_null($this->entitySort)) {
            $nativeSort = $this->entitySort;
        } else {
            // no explicit sort supplied, return false
            return false;
        }

        // convert to sql dialect if asked
        if ($format == 'sql') {
            // first_name,-last_name
            $sortFields = explode(',', $nativeSort);
            $parsedSorts = array(); // the final Phalcon friendly sort array

            foreach ($sortFields as $order) {
                if (substr($order, 0, 1) == '-') {
                    $subOrder = substr($order, 1);
                    if (!empty($subOrder)) {
                        $parsedSorts[] = $subOrder . " DESC";
                    }
                } else {
                    $parsedSorts[] = $order;
                }
            }
            $nativeSort = implode(',', $parsedSorts);
        }

        return $nativeSort;
    }
public function getSort($format = 'native')
    {
        if (!is_null($this->suppliedSort)) {
            $nativeSort = $this->suppliedSort;
        } elseif (!is_null($this->entitySort)) {
            $nativeSort = $this->entitySort;
        } else {
            // no explicit sort supplied, return false
            return false;
        }

        // convert to sql dialect if asked
        if ($format == 'sql') {
            // first_name,-last_name
            $sortFields = explode(',', $nativeSort);
            $parsedSorts = array(); // the final Phalcon friendly sort array

            foreach ($sortFields as $order) {
                if (substr($order, 0, 1) == '-') {
                    $subOrder = substr($order, 1);
                    if (!empty($subOrder)) {
                        $parsedSorts[] = $subOrder . " DESC";
                    }
                } else {
                    $parsedSorts[] = $order;
                }
            }
            $nativeSort = implode(',', $parsedSorts);
        }

        return $nativeSort;
    }
public function getSort ( $ format = 'native' ) { if ( ! is_null ( $ this -> suppliedSort ) ) { $ nativeSort = $ this -> suppliedSort ; } elseif ( ! is_null ( $ this -> entitySort ) ) { $ nativeSort = $ this -> entitySort ; } else { // no explicit sort supplied, return false return false ; } // convert to sql dialect if asked if ( $ format == 'sql' ) { // first_name,-last_name $ sortFields = explode ( ',' , $ nativeSort ) ; $ parsedSorts = array ( ) ; // the final Phalcon friendly sort array foreach ( $ sortFields as $ order ) { if ( substr ( $ order , 0 , 1 ) == '-' ) { $ subOrder = substr ( $ order , 1 ) ; if ( ! empty ( $ subOrder ) ) { $ parsedSorts [ ] = $ subOrder . " DESC" ; } } else { $ parsedSorts [ ] = $ order ; } } $ nativeSort = implode ( ',' , $ parsedSorts ) ; } return $ nativeSort ; }
return the correct sort based on set order
supplied, entity, none

@param string $format
return the native string format or a sql version instead?
@return mixed mixed return false when no sort if found, otherwise a string in native|sql format
return the correct sort based on set order supplied entity none