| @@ 81-95 (lines=15) @@ | ||
| 78 | ||
| 79 | if ($storeAs === ClassMetadataInfo::REFERENCE_STORE_AS_ID) { |
|
| 80 | $this->query[$mapping['name']] = $dbRef; |
|
| 81 | } else { |
|
| 82 | $keys = array('ref' => true, 'id' => true, 'db' => true); |
|
| 83 | ||
| 84 | if ($storeAs === ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF) { |
|
| 85 | unset($keys['db']); |
|
| 86 | } |
|
| 87 | ||
| 88 | if (isset($mapping['targetDocument'])) { |
|
| 89 | unset($keys['ref'], $keys['db']); |
|
| 90 | } |
|
| 91 | ||
| 92 | foreach ($keys as $key => $value) { |
|
| 93 | $this->query[$this->currentField . '.$' . $key] = $dbRef['$' . $key]; |
|
| 94 | } |
|
| 95 | } |
|
| 96 | } else { |
|
| 97 | $dbRef = $this->dm->createDBRef($document); |
|
| 98 | $this->query = $dbRef; |
|
| @@ 120-134 (lines=15) @@ | ||
| 117 | if ($storeAs === ClassMetadataInfo::REFERENCE_STORE_AS_ID) { |
|
| 118 | // TODO: This creates an invalid query ($elemMatch needs an Object) |
|
| 119 | $this->query[$mapping['name']]['$elemMatch'] = $dbRef; |
|
| 120 | } else { |
|
| 121 | $keys = array('ref' => true, 'id' => true, 'db' => true); |
|
| 122 | ||
| 123 | if ($storeAs === ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF) { |
|
| 124 | unset($keys['db']); |
|
| 125 | } |
|
| 126 | ||
| 127 | if (isset($mapping['targetDocument'])) { |
|
| 128 | unset($keys['ref'], $keys['db']); |
|
| 129 | } |
|
| 130 | ||
| 131 | foreach ($keys as $key => $value) { |
|
| 132 | $this->query[$this->currentField]['$elemMatch']['$' . $key] = $dbRef['$' . $key]; |
|
| 133 | } |
|
| 134 | } |
|
| 135 | } else { |
|
| 136 | $dbRef = $this->dm->createDBRef($document); |
|
| 137 | $this->query['$elemMatch'] = $dbRef; |
|