DDC-3069: [GH-1000] [DDC-3068] EntityManager::find accept array of object as id #3841

doctrinebot opened this Issue Apr 4, 2014 · 3 comments

2 participants


Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of giosh94mhz:

Url: #1000


Pull Request for ticket http://www.doctrine-project.org/jira/browse/[DDC-3068](http://www.doctrine-project.org/jira/browse/DDC-3068)
Here follow the ticket description for you convenience.

According to the documentation, EntityManager::find should return one entity given it's primary key. When a primary key of an entity is composed of multiple associations, one (me :)) would expect that the following works, but it doesn't:

$entity = $_em->find('My\EntityClass', array(
    'assoc1' => $instance1,
    'assoc2' => $instance2
PHP Fatal error:  Object of class My\EntityClass could not be converted to string

The only working way I've found is the following:

$entity = $_em->find('My\EntityClass', array(
    'assoc1' => $instance1->getId(),
    'assoc2' => $instance2->getId()

I think that this second scenario is not correct, since expose implementation details.


Comment created by @doctrinebot:

A related Github Pull-Request [GH-1000] was closed:


Comment created by @guilhermeblanco:

As of 10a0daf this issue was fixed.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.5 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment