Skip to content

Commit 5778d62

Browse files
authored
Update filters.md
- Clean the initial proposal - Add a referal to the existing documentation - Add a tip
1 parent d2e45c7 commit 5778d62

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

core/filters.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ class Offer
929929
}
930930
```
931931

932-
Or by using the `ApiFilter` annotation:
932+
Or by using the `ApiFilter` annotation
933933

934934
```php
935935
<?php
@@ -950,29 +950,9 @@ class Offer
950950
// ...
951951
}
952952
```
953+
When using `ApiFilter` annotation, the declared properties in the `services.yaml` will not be taken into account. You have to use the `ApiFilter` way (see the [documentation](#apifilter-annotation))
953954

954-
When using `ApiFilter` annotation, you can specify specific properties for which the filter will be applied:
955-
```
956-
<?php
957-
// api/src/Entity/Offer.php
958-
959-
namespace App\Entity;
960-
961-
use ApiPlatform\Core\Annotation\ApiFilter;
962-
use ApiPlatform\Core\Annotation\ApiResource;
963-
use App\Filter\RegexpFilter;
964-
965-
/**
966-
* @ApiResource
967-
* @ApiFilter(RegexpFilter::class, properties={"email","anOtherProperty"})
968-
*/
969-
class Offer
970-
{
971-
// ...
972-
}
973-
```
974-
975-
You can now enable this filter using URLs like `http://example.com/offers?regexp_email=^[FOO]`. This new filter will also
955+
Finally you can use this filter in the URL like `http://example.com/offers?regexp_email=^[FOO]`. This new filter will also
976956
appear in Swagger and Hydra documentations.
977957

978958
### Creating Custom Doctrine MongoDB ODM Filters

0 commit comments

Comments
 (0)