How to use OrderFilter correctly #2355
-
Hi, I'm trying to use the ApiPlatform\Doctrine\Orm\Filter\OrderFilter to get a ordered coolection by name, but it's not working at all. The Filter is applied via annotation like this:
Debugging leads me to the class ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\FilterExtension. But this extension is ignoring the filter because it is not implementing ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\FilterInterface Am I missing something? btw: the same happens to the SearchFilter Thx in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
If you are using API Platform 2.7 in compatibility mode, you are using the wrong filter. |
Beta Was this translation helpful? Give feedback.
-
Sorry to bother again. This works for filtering ans sorting but unfortunately my entities from a different entity manager do'nt work with 'metadata_backward_compatibility_layer' = false |
Beta Was this translation helpful? Give feedback.
If you are using API Platform 2.7 in compatibility mode, you are using the wrong filter.
You should use
ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter
.If you want to use the new filter, you need to disable the compatibility layer: https://api-platform.com/docs/core/upgrade-guide/