Code Duplication    Length = 11-11 lines in 2 locations

lib/Doctrine/ODM/MongoDB/Query/Expr.php 2 locations

@@ 69-79 (lines=11) @@
66
67
            if (isset($mapping['simple']) && $mapping['simple']) {
68
                $this->query[$mapping['name']] = $dbRef;
69
            } else {
70
                $keys = array('ref' => true, 'id' => true, 'db' => true);
71
72
                if (isset($mapping['targetDocument'])) {
73
                    unset($keys['ref'], $keys['db']);
74
                }
75
76
                foreach ($keys as $key => $value) {
77
                    $this->query[$this->currentField . '.$' . $key] = $dbRef['$' . $key];
78
                }
79
            }
80
        } else {
81
            $dbRef = $this->dm->createDBRef($document);
82
            $this->query = $dbRef;
@@ 99-109 (lines=11) @@
96
97
            if (isset($mapping['simple']) && $mapping['simple']) {
98
                $this->query[$mapping['name']]['$elemMatch'] = $dbRef;
99
            } else {
100
                $keys = array('ref' => true, 'id' => true, 'db' => true);
101
102
                if (isset($mapping['targetDocument'])) {
103
                    unset($keys['ref'], $keys['db']);
104
                }
105
106
                foreach ($keys as $key => $value) {
107
                    $this->query[$this->currentField]['$elemMatch']['$' . $key] = $dbRef['$' . $key];
108
                }
109
            }
110
        } else {
111
            $dbRef = $this->dm->createDBRef($document);
112
            $this->query['$elemMatch'] = $dbRef;