Skip to content

Commit 0ad2d76

Browse files
committed
Removal of deprecated extractProperties method in docs
1 parent 81ee38e commit 0ad2d76

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

core/filters.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,42 +1006,6 @@ final class UserFilterConfigurator
10061006

10071007
Done: Doctrine will automatically filter all "UserAware" entities!
10081008

1009-
### Overriding Extraction of Properties from the Request
1010-
1011-
You can change the way the filter parameters are extracted from the request. This can be done by overriding the `extractProperties(\Symfony\Component\HttpFoundation\Request $request)`
1012-
method.
1013-
1014-
In the following example, we will completely change the syntax of the order filter to be the following: `?filter[order][property]`
1015-
1016-
```php
1017-
<?php
1018-
// api/src/Filter/CustomOrderFilter.php
1019-
1020-
namespace App\Filter;
1021-
1022-
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
1023-
use Symfony\Component\HttpFoundation\Request;
1024-
1025-
final class CustomOrderFilter extends OrderFilter
1026-
{
1027-
protected function extractProperties(Request $request): array
1028-
{
1029-
return $request->query->get('filter[order]', []);
1030-
}
1031-
}
1032-
```
1033-
1034-
Finally, register the custom filter:
1035-
1036-
```yaml
1037-
# api/config/services.yaml
1038-
services:
1039-
# ...
1040-
'App\Filter\CustomOrderFilter': ~
1041-
# Uncomment only if autoconfiguration isn't enabled
1042-
#tags: [ 'api_platform.filter' ]
1043-
```
1044-
10451009
## ApiFilter Annotation
10461010

10471011
The annotation can be used on a `property` or on a `class`.

0 commit comments

Comments
 (0)