Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #31 from kusiboss/fetaure/datetime-filtertype-add-…
Browse files Browse the repository at this point in the history
…isnull-operator

feat: add is_empty operator
  • Loading branch information
tuxes3 authored Dec 14, 2023
2 parents 5f667b3 + 3b3226c commit b87ae85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Filter/Type/DatetimeFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class DatetimeFilterType extends FilterType

public const CRITERIA_IN_YEAR = 'in_year';

public const CRITERIA_IS_EMPTY = 'is_empty';

public function getOperators(): array
{
return [
Expand All @@ -26,6 +28,7 @@ public function getOperators(): array
static::CRITERIA_BEFORE => 'araise_table.filter.operator.before',
static::CRITERIA_AFTER => 'araise_table.filter.operator.after',
static::CRITERIA_IN_YEAR => 'araise_table.filter.operator.same_year',
static::CRITERIA_IS_EMPTY => 'araise_table.filter.operator.is_empty',
];
}

Expand Down Expand Up @@ -80,6 +83,8 @@ public function toDql(string $operator, string $value, string $parameterName, Qu
$queryBuilder->expr()->gte($this->getColumn(), sprintf(':%s', $parameterName.'_start')),
$queryBuilder->expr()->lte($this->getColumn(), sprintf(':%s', $parameterName.'_end'))
);
case static::CRITERIA_IS_EMPTY:
return $queryBuilder->expr()->isNull($column);
}

return null;
Expand Down

0 comments on commit b87ae85

Please sign in to comment.