Skip to content

Symfony Uuid not working with search filter #4360

@syntaxgirl

Description

@syntaxgirl

API Platform version(s) affected: 2.6.5

Description
I Created two entities. One of them have ManyToOne relation with another. I used Symfony uuid as a type for id, exposed both of them to api plaform, I tried to filter them based on URI from another entity. Each time I get 0 results found. If I use ramsey uuid instead, everything works as expected

Additional Context

use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV4;

#[ApiFilter(SearchFilter::class, properties: ['blog' => 'exact'])]

    /**
     * @var Uuid
     * @ApiProperty(identifier=true)
     * @ORM\Id
     * @ORM\Column(name="id", type="uuid", unique=true)
     */
    private $id;

    public function __construct()
    {
        $this->id = UuidV4::v4();
    }

    public function getId(): Uuid
    {
        return $this->id;
    }

Anyone was able to setup it correctly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions