@@ 604-615 (lines=12) @@ | ||
601 | * @param \MongoId|string $id id of document |
|
602 | * @return Document |
|
603 | */ |
|
604 | public function defineId($id) |
|
605 | { |
|
606 | if (!($id instanceof \MongoId)) { |
|
607 | try { |
|
608 | $id = new \MongoId($id); |
|
609 | } catch (\MongoException $e) {} |
|
610 | } |
|
611 | ||
612 | $this->mergeUnmodified(array('_id' => $id)); |
|
613 | ||
614 | return $this; |
|
615 | } |
|
616 | ||
617 | /** |
|
618 | * Used to define id of not stored document. |
|
@@ 623-632 (lines=10) @@ | ||
620 | * @param \MongoId|string $id id of document |
|
621 | * @return Document |
|
622 | */ |
|
623 | public function setId($id) |
|
624 | { |
|
625 | if (!($id instanceof \MongoId)) { |
|
626 | try { |
|
627 | $id = new \MongoId($id); |
|
628 | } catch (\MongoException $e) {} |
|
629 | } |
|
630 | ||
631 | return $this->set('_id', $id); |
|
632 | } |
|
633 | ||
634 | public function isStored() |
|
635 | { |