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