Skip to content

Native query being passed entities as parameters no longer works #11602

Open
@cs278

Description

@cs278

BC Break Report

Q A
BC Break yes
Version 2.19.6 -> 2.19.7

Summary

Native query being passed entities as parameters no longer works.

Previous behavior

If you passed an entity or array of entities as parameters to a native query the conversion to primary keys would automatically be taken care of by Doctrine.

Current behavior

Doctrine doesn't surface an error the entities are passed to PDO as objects which then tries to cast them to the appropriate type.

How to reproduce

$query = $this->em->createNativeQuery($sql, $rsm);
$query->setParameter('contacts', $contacts, ArrayParameterType::INTEGER);
$query->execute();

Results in:

Warning: Object of class Contact could not be converted to int

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions