-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot bind uuid_binary type to Doctrine's QueryBuilder #266
Comments
Can confirm. This renders doctrine v3 not yet usable when the project is using uuids. |
This might be very similar to doctrine/orm#11090 But breaks as well on the ManyToOne side (the mentioned MR solves the opposite OneToMany) |
This issue seems to stem from EAGER loading entities. It happens when the parameter is an association that EAGER loads. class Media
{
#[ORM\Id, ORM\Column(type: 'uuid_binary'), ORM\GeneratedValue(strategy: 'NONE')]
private UuidInterface $id; class MediaUploadAttempt
{
#[ORM\ManyToOne(targetEntity: Media::class, fetch: 'EAGER')]
#[ORM\JoinColumn(name: 'media_id', unique: true, nullable: true)]
private ?Media $uploadedMedia = null; class MediaUploadAttemptRepository extends ServiceEntityRepository
{
public function findOneByUploadedMediaId(UuidInterface $mediaId): ?MediaUploadAttempt
{
return $this->createQueryBuilder('a')
->andWhere('IDENTITY(a.uploadedMedia) = :mediaId')
->setParameter('mediaId', $mediaId->getBytes())
->getQuery()
->getOneOrNullResult();
} The above conditions produce the error |
The more I look into this, the more I see that this is not an issue of |
Description
A BINARY type does not seem to be supported in doctrine now.
If I bind the binary representation of the ID in a param I get an error from the ORM.
This is the parameter:
and the error is
Unhandled match case 16
which is coming from this method in doctrine/orm and is simply missing a match forParameterType::BINARY
.Adding the type explicitly results in the same error.
doctrine/orm: 3.1.3
doctrine/dbal: 3.8.4
ramsey/uuid-doctrine: 2.0.0
Edit: The above worked fine with
doctrine/orm: 2.19.4
doctrine/dbal: 3.8.3
ramsey/uuid-doctrine: 1.8.2
where the above method does not exist
Steps to reproduce
Use the QueryBuilder to retrieve data based on a foreign key with uuid_binary type
Expected behavior
To get the right data back from the database
Screenshots or output
Error is
Unhandled match case 16
Environment details
doctrine/orm: 3.1.3
doctrine/dbal: 3.8.4
ramsey/uuid-doctrine: 2.0.0
Additional context
The text was updated successfully, but these errors were encountered: