Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Entities with custom DBAL type identifier bound to DQL query parameters are not converted through DBAL types #8181

@Ocramius

Description

@Ocramius

Bug Report

Binding DQL query parameters to entities with primary key being mapped with a custom DBAL type does not lead to the identifiers being passed through the DBAL type conversion when the query is executed.

Q A
BC Break no
Version 2.7.3

Summary

Given:

class MyRot13Type extends Type { ... }

and

class MyEntity {
    private Rot13Value $id;
}

When calling:

$entity = new MyEntity();
$em->persist($entity);
$em->flush();

assert(
    null !== $em->createQuery('SELECT e FROM MyEntity e WHERE e = :id')
        ->setParameter('id', $entity)
        ->getOneOrNullResult()
);

Current behavior

The above will report zero results.

Expected behavior

The above should report one result

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions