private function resolveOrderName(
        $col,
        Meta $meta,
        $alias = null,
        $defaultOrder = 'ASC',
        &$alreadyResolved = []
    ) {
        list($col, $order) = Query::getOrderDirection($col, $defaultOrder);

        $nameParts = explode(BaseLookup::LOOKUP_SEPARATOR, $col);

        /* @var $targetField Field */
        list(
            $relationField, $targetFields, $alias, $joinList, $paths,
            $meta
            ) = $this->_setupJoins($nameParts, $meta, $alias);

        if ($relationField->isRelation && $meta->getOrderBy() &&
            empty($relationField->getAttrName())) {
            throw new NotImplemented(
                'This capability is yet to be implemented'
            );
        }

        list($targets, $alias, $joinList) = $this->query->trimJoins(
            $targetFields,
            $joinList,
            $paths
        );

        $fields = [];

        $descending = ('DESC' == $order) ? true : false;

        // convert the names to expressions

        /** @var $target Field */
        foreach ($targets as $target) {
            $fields[] = [
                new OrderBy($target->getColExpression($alias), $descending),
                false,
            ];
        }

        return $fields;
    }
private function resolveOrderName(
        $col,
        Meta $meta,
        $alias = null,
        $defaultOrder = 'ASC',
        &$alreadyResolved = []
    ) {
        list($col, $order) = Query::getOrderDirection($col, $defaultOrder);

        $nameParts = explode(BaseLookup::LOOKUP_SEPARATOR, $col);

        /* @var $targetField Field */
        list(
            $relationField, $targetFields, $alias, $joinList, $paths,
            $meta
            ) = $this->_setupJoins($nameParts, $meta, $alias);

        if ($relationField->isRelation && $meta->getOrderBy() &&
            empty($relationField->getAttrName())) {
            throw new NotImplemented(
                'This capability is yet to be implemented'
            );
        }

        list($targets, $alias, $joinList) = $this->query->trimJoins(
            $targetFields,
            $joinList,
            $paths
        );

        $fields = [];

        $descending = ('DESC' == $order) ? true : false;

        // convert the names to expressions

        /** @var $target Field */
        foreach ($targets as $target) {
            $fields[] = [
                new OrderBy($target->getColExpression($alias), $descending),
                false,
            ];
        }

        return $fields;
    }
private function resolveOrderName ( $ col , Meta $ meta , $ alias = null , $ defaultOrder = 'ASC' , & $ alreadyResolved = [ ] ) { list ( $ col , $ order ) = Query :: getOrderDirection ( $ col , $ defaultOrder ) ; $ nameParts = explode ( BaseLookup :: LOOKUP_SEPARATOR , $ col ) ; /* @var $targetField Field */ list ( $ relationField , $ targetFields , $ alias , $ joinList , $ paths , $ meta ) = $ this -> _setupJoins ( $ nameParts , $ meta , $ alias ) ; if ( $ relationField -> isRelation && $ meta -> getOrderBy ( ) && empty ( $ relationField -> getAttrName ( ) ) ) { throw new NotImplemented ( 'This capability is yet to be implemented' ) ; } list ( $ targets , $ alias , $ joinList ) = $ this -> query -> trimJoins ( $ targetFields , $ joinList , $ paths ) ; $ fields = [ ] ; $ descending = ( 'DESC' == $ order ) ? true : false ; // convert the names to expressions /** @var $target Field */ foreach ( $ targets as $ target ) { $ fields [ ] = [ new OrderBy ( $ target -> getColExpression ( $ alias ) , $ descending ) , false , ] ; } return $ fields ; }
Tries ot resolve a name like 'username' into a model field and then into
Col expression suitable for making queries.

@param        $col
@param Meta   $meta
@param null   $alias
@param string $defaultOrder
@param array  $alreadyResolved helps avoid infinite loops

@return array

@throws KeyError
@throws NotImplemented
@throws \Eddmash\PowerOrm\Exception\ValueError

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Tries ot resolve a name like username into a model field and then into Col expression suitable for making queries .