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