@@ 209-216 (lines=8) @@ | ||
206 | $document->set($field, $this->document->getId())->save(); |
|
207 | break; |
|
208 | ||
209 | case Document::RELATION_MANY_MANY: |
|
210 | $isRelationListStoredInternally = isset($relation[3]) && $relation[3]; |
|
211 | if ($isRelationListStoredInternally) { |
|
212 | $this->document->push($field, $document->getId())->save(); |
|
213 | } else { |
|
214 | $document->push($field, $this->document->getId())->save(); |
|
215 | } |
|
216 | break; |
|
217 | ||
218 | default: |
|
219 | throw new \Sokil\Mongo\Exception( |
|
@@ 268-278 (lines=11) @@ | ||
265 | break; |
|
266 | ||
267 | ||
268 | case Document::RELATION_MANY_MANY: |
|
269 | if (!$document) { |
|
270 | throw new \Sokil\Mongo\Exception('Related document must be defined'); |
|
271 | } |
|
272 | $isRelationListStoredInternally = isset($relation[3]) && $relation[3]; |
|
273 | if ($isRelationListStoredInternally) { |
|
274 | $this->document->pull($field, $document->getId())->save(); |
|
275 | } else { |
|
276 | $document->pull($field, $this->document->getId())->save(); |
|
277 | } |
|
278 | break; |
|
279 | ||
280 | default: |
|
281 | throw new \Sokil\Mongo\Exception( |