@@ 79-95 (lines=17) @@ | ||
76 | $dbRef = $this->dm->createDBRef($document, $mapping); |
|
77 | $storeAs = array_key_exists('storeAs', $mapping) ? $mapping['storeAs'] : null; |
|
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[$mapping['name'] . '.$' . $key] = $dbRef['$' . $key]; |
|
94 | } |
|
95 | } |
|
96 | } else { |
|
97 | $dbRef = $this->dm->createDBRef($document); |
|
98 | $this->query = $dbRef; |
|
@@ 117-133 (lines=17) @@ | ||
114 | $dbRef = $this->dm->createDBRef($document, $mapping); |
|
115 | $storeAs = array_key_exists('storeAs', $mapping) ? $mapping['storeAs'] : null; |
|
116 | ||
117 | if ($storeAs === ClassMetadataInfo::REFERENCE_STORE_AS_ID) { |
|
118 | $this->query[$mapping['name']] = $dbRef; |
|
119 | } else { |
|
120 | $keys = array('ref' => true, 'id' => true, 'db' => true); |
|
121 | ||
122 | if ($storeAs === ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF) { |
|
123 | unset($keys['db']); |
|
124 | } |
|
125 | ||
126 | if (isset($mapping['targetDocument'])) { |
|
127 | unset($keys['ref'], $keys['db']); |
|
128 | } |
|
129 | ||
130 | foreach ($keys as $key => $value) { |
|
131 | $this->query[$mapping['name']]['$elemMatch']['$' . $key] = $dbRef['$' . $key]; |
|
132 | } |
|
133 | } |
|
134 | } else { |
|
135 | $dbRef = $this->dm->createDBRef($document); |
|
136 | $this->query['$elemMatch'] = $dbRef; |