| @@ 82-98 (lines=17) @@ | ||
| 79 | && $mapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_ID |
|
| 80 | ) { |
|
| 81 | $this->query[$mapping['name']] = $dbRef; |
|
| 82 | } else { |
|
| 83 | $keys = array('ref' => true, 'id' => true, 'db' => true); |
|
| 84 | ||
| 85 | if (array_key_exists('storeAs', $mapping) |
|
| 86 | && $mapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF |
|
| 87 | ) { |
|
| 88 | unset($keys['db']); |
|
| 89 | } |
|
| 90 | ||
| 91 | if (isset($mapping['targetDocument'])) { |
|
| 92 | unset($keys['ref'], $keys['db']); |
|
| 93 | } |
|
| 94 | ||
| 95 | foreach ($keys as $key => $value) { |
|
| 96 | $this->query[$this->currentField . '.$' . $key] = $dbRef['$' . $key]; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } else { |
|
| 100 | $dbRef = $this->dm->createDBRef($document); |
|
| 101 | $this->query = $dbRef; |
|
| @@ 123-139 (lines=17) @@ | ||
| 120 | && $mapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_ID |
|
| 121 | ) { |
|
| 122 | $this->query[$mapping['name']]['$elemMatch'] = $dbRef; |
|
| 123 | } else { |
|
| 124 | $keys = array('ref' => true, 'id' => true, 'db' => true); |
|
| 125 | ||
| 126 | if (array_key_exists('storeAs', $mapping) |
|
| 127 | && $mapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF |
|
| 128 | ) { |
|
| 129 | unset($keys['db']); |
|
| 130 | } |
|
| 131 | ||
| 132 | if (isset($mapping['targetDocument'])) { |
|
| 133 | unset($keys['ref'], $keys['db']); |
|
| 134 | } |
|
| 135 | ||
| 136 | foreach ($keys as $key => $value) { |
|
| 137 | $this->query[$this->currentField]['$elemMatch']['$' . $key] = $dbRef['$' . $key]; |
|
| 138 | } |
|
| 139 | } |
|
| 140 | } else { |
|
| 141 | $dbRef = $this->dm->createDBRef($document); |
|
| 142 | $this->query['$elemMatch'] = $dbRef; |
|