diff --git a/src/Behavior/NonTextMatch.php b/src/Behavior/NonTextMatch.php new file mode 100644 index 0000000..4ab19ff --- /dev/null +++ b/src/Behavior/NonTextMatch.php @@ -0,0 +1,36 @@ +getDb()->getAdapter() instanceof Pgsql) { + $this->query = $query; + } + + return $this; + } + + public function rewriteCondition(Filter\Condition $condition, $relation = null) + { + if ($this->query === null || (! $condition instanceof Filter\Like && ! $condition instanceof Filter\Unlike)) { + return null; + } + + $columnDefinition = $this->query->getResolver()->getColumnDefinition($condition->metaData()->get('columnPath')); + if ($columnDefinition->getType() !== 'text') { + $condition->setColumn($condition->getColumn() . '::text'); + } + } +}