Skip to content

Commit 5ac197b

Browse files
authored
fix: fatal error when using strategy => XYZ (#1398)
1 parent af92c75 commit 5ac197b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/filters.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ class DummyCar
16161616
/**
16171617
* @ORM\Column(type="string")
16181618
*/
1619-
#[ApiFilter(SearchFilter::class, strategy => 'partial')]
1619+
#[ApiFilter(SearchFilter::class, strategy: 'partial')]
16201620
public $name;
16211621
16221622
/**
@@ -1632,7 +1632,7 @@ class DummyCar
16321632
On the first property, `name`, it's straightforward. The first annotation argument is the filter class, the second specifies options, here, the strategy:
16331633

16341634
```php
1635-
#[ApiFilter(SearchFilter::class, strategy => 'partial')]
1635+
#[ApiFilter(SearchFilter::class, strategy: 'partial')]
16361636
```
16371637

16381638
In the second annotation, we specify `properties` on which the filter should apply. It's necessary here because we don't want to filter `colors` but the `prop` property of the `colors` association.
@@ -1663,7 +1663,7 @@ use Doctrine\ORM\Mapping as ORM;
16631663
16641664
#[ApiResource]
16651665
#[ApiFilter(BooleanFilter::class)]
1666-
#[ApiFilter(DateFilter::class, strategy => DateFilter::EXCLUDE_NULL)]
1666+
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
16671667
#[ApiFilter(SearchFilter::class, properties: ['colors.prop' => 'ipartial', 'name' => 'partial'])]
16681668
#[ApiFilter(PropertyFilter::class, arguments: ['parameterName' => 'foobar'])]
16691669
#[ApiFilter(GroupFilter::class, arguments: ['parameterName' => 'foobargroups'])]
@@ -1683,7 +1683,7 @@ The `BooleanFilter` is applied to every `Boolean` property of the class. Indeed,
16831683
The `DateFilter` given here will be applied to every `Date` property of the `DummyCar` class with the `DateFilter::EXCLUDE_NULL` strategy:
16841684

16851685
```php
1686-
#[ApiFilter(DateFilter::class, strategy => DateFilter::EXCLUDE_NULL)]
1686+
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
16871687
```
16881688

16891689
The `SearchFilter` here adds properties. The result is the exact same as the example with annotations on properties:

0 commit comments

Comments
 (0)