Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 90-100 (lines=11) @@
87
88
            if (isset($mapping['simple']) && $mapping['simple']) {
89
                $this->query[$mapping['name']] = $dbRef;
90
            } else {
91
                $keys = array('ref' => true, 'id' => true, 'db' => true);
92
93
                if (isset($mapping['targetDocument'])) {
94
                    unset($keys['ref'], $keys['db']);
95
                }
96
97
                foreach ($keys as $key => $value) {
98
                    $this->query[$this->currentField . '.$' . $key] = $dbRef['$' . $key];
99
                }
100
            }
101
        } else {
102
            $dbRef = $this->dm->createDBRef($document);
103
            $this->query = $dbRef;
@@ 120-130 (lines=11) @@
117
118
            if (isset($mapping['simple']) && $mapping['simple']) {
119
                $this->query[$mapping['name']]['$elemMatch'] = $dbRef;
120
            } else {
121
                $keys = array('ref' => true, 'id' => true, 'db' => true);
122
123
                if (isset($mapping['targetDocument'])) {
124
                    unset($keys['ref'], $keys['db']);
125
                }
126
127
                foreach ($keys as $key => $value) {
128
                    $this->query[$this->currentField]['$elemMatch']['$' . $key] = $dbRef['$' . $key];
129
                }
130
            }
131
        } else {
132
            $dbRef = $this->dm->createDBRef($document);
133
            $this->query['$elemMatch'] = $dbRef;