php - Why does Symfony API Platform ignore filters?
Get the solution ↓↓↓I am working on a Symfony 5 + API Platform project. I am still fighting with API Filters. I made this work before setting up a fake API route from some controller. But, since there is an API Platform out of the box feature that allow this, I would like to "make" this work.
First of all, the entity filters are being ignored and API Platform is aware of that. According to Symfony Profiler > API Platform > Resource Metadata:
And according to Data Providers tab in the same page:
What I have tried so far is adding@ApiFilter()
annotation toQuestion
entity like API documentation explains:
// ...
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=QuestionRepository::class)
* @ApiResource(normalizationContext={"groups"={"question"}})
* @ApiFilter(SearchFilter::class, properties={"status": "partial"})
*/
class Question
{
// ...
/**
* @ORM\Column(type="string", length=255)
* @Groups("question")
*/
private $status;
// ...
}
I also have tried to specify the filter on the needed property to be filtered. (Thanks to @EugeneRuban from a previous question).
So that, why does API Platform ignores the filter?
Edit: This is what the Logs shows:
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: failed to create image decoder with message 'unimplemented'
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.