Skip to content

Commit d8902fa

Browse files
committed
refactor(doctrine): reference order filters constants from interface
1 parent c2149d0 commit d8902fa

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

core/filters.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,13 +1050,13 @@ App\Entity\Offer:
10501050
When the property used for ordering can contain `null` values, you may want to specify how `null` values are treated in
10511051
the comparison:
10521052

1053-
| Description | Strategy to set |
1054-
| ------------------------------------ | ---------------------------------------------------------------------------------------- |
1055-
| Use the default behavior of the DBMS | `null` |
1056-
| Consider items as smallest | `ApiPlatform\Doctrine\Orm\Filter\OrderFilter::NULLS_SMALLEST` (`nulls_smallest`) |
1057-
| Consider items as largest | `ApiPlatform\Doctrine\Orm\Filter\OrderFilter::NULLS_LARGEST` (`nulls_largest`) |
1058-
| Order items always first | `ApiPlatform\Doctrine\Orm\Filter\OrderFilter::NULLS_ALWAYS_FIRST` (`nulls_always_first`) |
1059-
| Order items always last | `ApiPlatform\Doctrine\Orm\Filter\OrderFilter::NULLS_ALWAYS_LAST` (`nulls_always_last`) |
1053+
| Description | Strategy to set |
1054+
| ------------------------------------ |---------------------------------------------------------------------------------------------------|
1055+
| Use the default behavior of the DBMS | `null` |
1056+
| Consider items as smallest | `ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface::NULLS_SMALLEST` (`nulls_smallest`) |
1057+
| Consider items as largest | `ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface::NULLS_LARGEST` (`nulls_largest`) |
1058+
| Order items always first | `ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface::NULLS_ALWAYS_FIRST` (`nulls_always_first`) |
1059+
| Order items always last | `ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface::NULLS_ALWAYS_LAST` (`nulls_always_last`) |
10601060

10611061
For instance, treat entries with a property value of `null` as the smallest, with the following service definition:
10621062

@@ -1067,12 +1067,13 @@ For instance, treat entries with a property value of `null` as the smallest, wit
10671067
// api/src/Entity/Offer.php
10681068
namespace App\Entity;
10691069
1070+
use ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface;
10701071
use ApiPlatform\Metadata\ApiFilter;
10711072
use ApiPlatform\Metadata\ApiResource;
10721073
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
10731074
10741075
#[ApiResource]
1075-
#[ApiFilter(OrderFilter::class, properties: ['validFrom' => ['nulls_comparison' => OrderFilter::NULLS_SMALLEST, 'default_direction' => 'DESC']])]
1076+
#[ApiFilter(OrderFilter::class, properties: ['validFrom' => ['nulls_comparison' => OrderFilterInterface::NULLS_SMALLEST, 'default_direction' => 'DESC']])]
10761077
class Offer
10771078
{
10781079
// ...

0 commit comments

Comments
 (0)