protected function _prefix(RepositoryInterface $object, $order, $whitelisted = false)
    {
        $tableAlias = $object->getAlias();
        $tableOrder = [];
        foreach ($order as $key => $value) {
            if (is_numeric($key)) {
                $tableOrder[] = $value;
                continue;
            }
            $field = $key;
            $alias = $tableAlias;

            if (strpos($key, '.') !== false) {
                list($alias, $field) = explode('.', $key);
            }
            $correctAlias = ($tableAlias === $alias);

            if ($correctAlias && $whitelisted) {
                // Disambiguate fields in schema. As id is quite common.
                if ($object->hasField($field)) {
                    $field = $alias . '.' . $field;
                }
                $tableOrder[$field] = $value;
            } elseif ($correctAlias && $object->hasField($field)) {
                $tableOrder[$tableAlias . '.' . $field] = $value;
            } elseif (!$correctAlias && $whitelisted) {
                $tableOrder[$alias . '.' . $field] = $value;
            }
        }

        return $tableOrder;
    }
protected function _prefix(RepositoryInterface $object, $order, $whitelisted = false)
    {
        $tableAlias = $object->getAlias();
        $tableOrder = [];
        foreach ($order as $key => $value) {
            if (is_numeric($key)) {
                $tableOrder[] = $value;
                continue;
            }
            $field = $key;
            $alias = $tableAlias;

            if (strpos($key, '.') !== false) {
                list($alias, $field) = explode('.', $key);
            }
            $correctAlias = ($tableAlias === $alias);

            if ($correctAlias && $whitelisted) {
                // Disambiguate fields in schema. As id is quite common.
                if ($object->hasField($field)) {
                    $field = $alias . '.' . $field;
                }
                $tableOrder[$field] = $value;
            } elseif ($correctAlias && $object->hasField($field)) {
                $tableOrder[$tableAlias . '.' . $field] = $value;
            } elseif (!$correctAlias && $whitelisted) {
                $tableOrder[$alias . '.' . $field] = $value;
            }
        }

        return $tableOrder;
    }
protected function _prefix ( RepositoryInterface $ object , $ order , $ whitelisted = false ) { $ tableAlias = $ object -> getAlias ( ) ; $ tableOrder = [ ] ; foreach ( $ order as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ tableOrder [ ] = $ value ; continue ; } $ field = $ key ; $ alias = $ tableAlias ; if ( strpos ( $ key , '.' ) !== false ) { list ( $ alias , $ field ) = explode ( '.' , $ key ) ; } $ correctAlias = ( $ tableAlias === $ alias ) ; if ( $ correctAlias && $ whitelisted ) { // Disambiguate fields in schema. As id is quite common. if ( $ object -> hasField ( $ field ) ) { $ field = $ alias . '.' . $ field ; } $ tableOrder [ $ field ] = $ value ; } elseif ( $ correctAlias && $ object -> hasField ( $ field ) ) { $ tableOrder [ $ tableAlias . '.' . $ field ] = $ value ; } elseif ( ! $ correctAlias && $ whitelisted ) { $ tableOrder [ $ alias . '.' . $ field ] = $ value ; } } return $ tableOrder ; }
Prefixes the field with the table alias if possible.

@param \Cake\Datasource\RepositoryInterface $object Repository object.
@param array $order Order array.
@param bool $whitelisted Whether or not the field was whitelisted.
@return array Final order array.
Prefixes the field with the table alias if possible .