configuration-converter-bundle icon indicating copy to clipboard operation
configuration-converter-bundle copied to clipboard

Custom API filter error

Open bricejulia opened this issue 5 years ago • 2 comments

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 ?

bricejulia avatar Sep 30 '19 06:09 bricejulia

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 avatar Sep 30 '19 06:09 GregoireHebert

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

GregoireHebert avatar Sep 30 '19 17:09 GregoireHebert