Skip to content

Commit f90bde6

Browse files
committed
Use string values in DateFilter null-management constants
1 parent c88496b commit f90bde6

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.0.0 beta 4
4+
5+
* Use string values for `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter` null-management constants
6+
37
## 1.0.0 beta 3
48

59
* The Hydra documentation URL is now `/apidoc` (was `/vocab`)

Doctrine/Orm/Filter/DateFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class DateFilter extends AbstractFilter
2626
{
2727
const PARAMETER_BEFORE = 'before';
2828
const PARAMETER_AFTER = 'after';
29-
const EXCLUDE_NULL = 0;
30-
const INCLUDE_NULL_BEFORE = 1;
31-
const INCLUDE_NULL_AFTER = 2;
29+
const EXCLUDE_NULL = 'exclude_null';
30+
const INCLUDE_NULL_BEFORE = 'include_null_before';
31+
const INCLUDE_NULL_AFTER = 'include_null_after';
3232

3333
/**
3434
* @var array

Resources/doc/filters.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ As others filters, the date filter must be explicitly enabled:
9191
# app/config/services.yml
9292
9393
services:
94-
# Enable date filter for for the property "dateProperty" of the resource "resource.offer"
94+
# Enable date filter for the property "dateProperty" of the resource "resource.offer"
9595
resource.date_filter:
9696
parent: "api.doctrine.orm.date_filter"
9797
arguments: [ { "dateProperty": ~ } ]
@@ -110,12 +110,12 @@ services:
110110
The date filter is able to deal with date properties having `null` values.
111111
Four behaviors are available at the property level of the filter:
112112

113-
| Description | Strategy to set |
114-
|--------------------------------------|-------------------------------------------------------------------------------|
115-
| Use the default behavior of the DBMS | `null` |
116-
| Exclude items | `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter::EXCLUDE_NULL` (`0`) |
117-
| Consider items as oldest | `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_BEFORE` (`1`) |
118-
| Consider items as youngest | `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_AFTER` (`2`) |
113+
| Description | Strategy to set |
114+
|--------------------------------------|-------------------------------------------------------------------------------------------------|
115+
| Use the default behavior of the DBMS | `null` |
116+
| Exclude items | `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter::EXCLUDE_NULL` (`exclude_null`) |
117+
| Consider items as oldest | `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_BEFORE` (`include_null_before`) |
118+
| Consider items as youngest | `Dunglas\ApiBundle\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_AFTER` (`include_null_after`) |
119119

120120
For instance, exclude entries with a property value of `null`, with the following service definition:
121121

@@ -126,7 +126,7 @@ For instance, exclude entries with a property value of `null`, with the followin
126126
services:
127127
resource.date_filter:
128128
parent: "api.doctrine.orm.date_filter"
129-
arguments: [ { "dateProperty": ~ } ]
129+
arguments: [ { "dateProperty": exclude_null } ]
130130
131131
resource.offer:
132132
parent: "api.resource"

0 commit comments

Comments
 (0)