| @@ 570-581 (lines=12) @@ | ||
| 567 | * @param \MongoId|string $id id of document |
|
| 568 | * @return Document |
|
| 569 | */ |
|
| 570 | public function defineId($id) |
|
| 571 | { |
|
| 572 | if (!($id instanceof \MongoId)) { |
|
| 573 | try { |
|
| 574 | $id = new \MongoId($id); |
|
| 575 | } catch (\MongoException $e) {} |
|
| 576 | } |
|
| 577 | ||
| 578 | $this->mergeUnmodified(array('_id' => $id)); |
|
| 579 | ||
| 580 | return $this; |
|
| 581 | } |
|
| 582 | ||
| 583 | /** |
|
| 584 | * Used to define id of not stored document. |
|
| @@ 589-598 (lines=10) @@ | ||
| 586 | * @param \MongoId|string $id id of document |
|
| 587 | * @return Document |
|
| 588 | */ |
|
| 589 | public function setId($id) |
|
| 590 | { |
|
| 591 | if (!($id instanceof \MongoId)) { |
|
| 592 | try { |
|
| 593 | $id = new \MongoId($id); |
|
| 594 | } catch (\MongoException $e) {} |
|
| 595 | } |
|
| 596 | ||
| 597 | return $this->set('_id', $id); |
|
| 598 | } |
|
| 599 | ||
| 600 | public function isStored() |
|
| 601 | { |
|