protected function _removeAliasesFromConditions($query)
    {
        if ($query->clause('join')) {
            throw new \RuntimeException(
                'Aliases are being removed from conditions for UPDATE/DELETE queries, ' .
                'this can break references to joined tables.'
            );
        }

        $conditions = $query->clause('where');
        if ($conditions) {
            $conditions->traverse(function ($condition) {
                if (!($condition instanceof Comparison)) {
                    return $condition;
                }

                $field = $condition->getField();
                if ($field instanceof ExpressionInterface || strpos($field, '.') === false) {
                    return $condition;
                }

                list(, $field) = explode('.', $field);
                $condition->setField($field);

                return $condition;
            });
        }

        return $query;
    }
protected function _removeAliasesFromConditions($query)
    {
        if ($query->clause('join')) {
            throw new \RuntimeException(
                'Aliases are being removed from conditions for UPDATE/DELETE queries, ' .
                'this can break references to joined tables.'
            );
        }

        $conditions = $query->clause('where');
        if ($conditions) {
            $conditions->traverse(function ($condition) {
                if (!($condition instanceof Comparison)) {
                    return $condition;
                }

                $field = $condition->getField();
                if ($field instanceof ExpressionInterface || strpos($field, '.') === false) {
                    return $condition;
                }

                list(, $field) = explode('.', $field);
                $condition->setField($field);

                return $condition;
            });
        }

        return $query;
    }
protected function _removeAliasesFromConditions ( $ query ) { if ( $ query -> clause ( 'join' ) ) { throw new \ RuntimeException ( 'Aliases are being removed from conditions for UPDATE/DELETE queries, ' . 'this can break references to joined tables.' ) ; } $ conditions = $ query -> clause ( 'where' ) ; if ( $ conditions ) { $ conditions -> traverse ( function ( $ condition ) { if ( ! ( $ condition instanceof Comparison ) ) { return $ condition ; } $ field = $ condition -> getField ( ) ; if ( $ field instanceof ExpressionInterface || strpos ( $ field , '.' ) === false ) { return $ condition ; } list ( , $ field ) = explode ( '.' , $ field ) ; $ condition -> setField ( $ field ) ; return $ condition ; } ) ; } return $ query ; }
Removes aliases from the `WHERE` clause of a query.

@param \Cake\Database\Query $query The query to process.
@return \Cake\Database\Query The modified query.
@throws \RuntimeException In case the processed query contains any joins, as removing
aliases from the conditions can break references to the joined tables.
Removes aliases from the WHERE clause of a query .