public function setId($id) { $mongoId = null; if (is_object($id)) { $mongoId = $id; } else { if ($this->_modelsManager->isUsingImplicitObjectIds($this)) { $mongoId = new ObjectID($id); } else { $mongoId = $id; } } $this->_id = $mongoId; }