Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Custom API filter error #10

Open
bricejulia opened this issue Sep 30, 2019 · 2 comments
Open

Custom API filter error #10

bricejulia opened this issue Sep 30, 2019 · 2 comments

Comments

@bricejulia
Copy link

Hello,

Thanks for your bundle, love the idea.
I've just started playing with it and it seems great.
But I get an error when I try to use it on a Entity with a custom api platform filter.

Example:

<?php

declare(strict_types = 1);

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use App\Filter\OrSearchFilter;

 * @ApiResource(
 *      collectionOperations={"get"},
 *      itemOperations={"get"},
 *      attributes={
 *          "normalization_context"={"groups"={"job:read"}},
 *          "denormalization_context"={"groups"={}}
 *      }
 * )
 *
 * @ApiFilter(OrderFilter::class, properties={"name", "createdAt", "updatedAt"})
 * @ApiFilter(OrSearchFilter::class, properties={"search": {
 *     "name",
 *     "nafs.code"
 * }})

Here, OrSearchFilter is my custom filter.

Error message:

 ! [NOTE] Converting resource: App\Entity\Job


 [ERROR] Notice: Undefined index: App\Filter\OrSearchFilter

Do you have any ideas ?

@GregoireHebert
Copy link
Owner

Thanks!

No idea yet but I did not tested with a custom filter so far,that's cool! I'll look for a solution :)

@GregoireHebert
Copy link
Owner

I tried to write a fix in the train... can you tell me if it work properly now? :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants