DocumentRepository::find() when ID object also contains ID field name #768

jmikola opened this Issue Jan 16, 2014 · 0 comments


None yet
2 participants

jmikola commented Jan 16, 2014

There appears to be logic DocumentRepository::find() to support passing a document as the $id parameter and unwrapping the identifier field value.

public function find($id, $lockMode = LockMode::NONE, $lockVersion = null)
    // ...

    /* TODO: What if the ID object has a field with the same name as the
     * class' mapped identifier field name?
    if (is_array($id)) {
        list($identifierFieldName) = $this->class->getIdentifierFieldNames();

        if (isset($id[$identifierFieldName])) {
            $id = $id[$identifierFieldName];

None of the tests in ODM depend on this functionality; however, some userland code may be. Consider removing this in 2.0.

@ghost ghost assigned jwage Jan 16, 2014

@malarzm malarzm assigned jmikola and unassigned jwage Jul 30, 2015

@jmikola jmikola modified the milestones: 2.0.0, 1.0.0 Aug 18, 2015

@jmikola jmikola added the task label Aug 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment