|
@@ 191-196 (lines=6) @@
|
| 188 |
|
$this->document->set($field, $document->getId()); |
| 189 |
|
break; |
| 190 |
|
|
| 191 |
|
case Document::RELATION_HAS_ONE: |
| 192 |
|
if (!$this->document->isStored()) { |
| 193 |
|
throw new \Sokil\Mongo\Exception( |
| 194 |
|
'Document ' . get_class($this) . ' must be saved before adding relation' |
| 195 |
|
); |
| 196 |
|
} |
| 197 |
|
$document->set($field, $this->document->getId())->save(); |
| 198 |
|
break; |
| 199 |
|
|
|
@@ 200-205 (lines=6) @@
|
| 197 |
|
$document->set($field, $this->document->getId())->save(); |
| 198 |
|
break; |
| 199 |
|
|
| 200 |
|
case Document::RELATION_HAS_MANY: |
| 201 |
|
if (!$this->document->isStored()) { |
| 202 |
|
throw new \Sokil\Mongo\Exception( |
| 203 |
|
'Document ' . get_class($this) . ' must be saved before adding relation' |
| 204 |
|
); |
| 205 |
|
} |
| 206 |
|
$document->set($field, $this->document->getId())->save(); |
| 207 |
|
break; |
| 208 |
|
|