ramsey/uuid-doctrine

Strange symbols with "uuid_binary / UuidBinaryType"

GaylordP opened this issue · 3 comments

Hello,

With Symfony 5, and Doctrine, I have this query :

`

    return $this
        ->createQueryBuilder('forum', 'forum.id')
        ->select('
            forum
        ')
        ->getQuery()
        ->getResult()
    ;

`

As you can see, the keys to my array are "forum.id".

When I use "uuid / UuidType" for my IDs, it works well: my table keys are uuid.
But when I use "uuid_binary / UuidBinaryType", my table keys are strange symbols :

b"³ ø«\x11\x1EJe¸+¤\fu\x19­F" => App\Entity\Forum
b"\x03?ïå&ŽOŽ¹\x02ص\t\x1A" => App\Entity\Forum

Can you help me to fix this ?
I know I can do a foreach to define my keys myself but it's a shame

When using uuid_binnary, UUID will b stored as binary data. These strange symbols are a representation of bytes. If you want to receive a string, you can use the toString method in UUID object.

Thanks very much :)

Thanks, @NavyCoat!