protected function decorateWhere($method, &$args)
    {
        $column = $args[0];
        $expression = isset($args[1]) ? $args[1] : null;
        $value = isset($args[2]) ? $args[2] : null;

        if (!$expression instanceof Entity && !$value instanceof Entity) {
            return;
        }

        $entity_class = $this->entity_class;
        $relation = $entity_class::getRelationDefinition($column);
        $column = $relation[3];
        $relation_column = $relation[2];
        if ($expression instanceof Entity) {
            $expression = $expression->getRaw($relation_column);
        } else {
            $value = $value->getRaw($relation_column);
        }

        $args = [$column, $expression, $value];
    }