namespaceSeparator !== $namespaceSeparator) { $this->triggerOptionEvent('namespace_separator', $namespaceSeparator); $this->namespaceSeparator = $namespaceSeparator; } return $this; } /** * Get namespace separator * * @return string */ public function getNamespaceSeparator() { return $this->namespaceSeparator; } /** * Set the mongodb resource manager to use * * @param null|MongoDbResourceManager $resourceManager * * @return MongoDbOptions Provides a fluent interface */ public function setResourceManager(MongoDbResourceManager $resourceManager = null) { if ($this->resourceManager !== $resourceManager) { $this->triggerOptionEvent('resource_manager', $resourceManager); $this->resourceManager = $resourceManager; } return $this; } /** * Get the mongodb resource manager * * @return MongoDbResourceManager */ public function getResourceManager() { return $this->resourceManager ?: $this->resourceManager = new MongoDbResourceManager(); } /** * Get the mongodb resource id * * @return string */ public function getResourceId() { return $this->resourceId; } /** * Set the mongodb resource id * * @param string $resourceId * * @return MongoDbOptions Provides a fluent interface */ public function setResourceId($resourceId) { $resourceId = (string) $resourceId; if ($this->resourceId !== $resourceId) { $this->triggerOptionEvent('resource_id', $resourceId); $this->resourceId = $resourceId; } return $this; } /** * Set the mongo DB server * * @param string $server * * @return MongoDbOptions Provides a fluent interface */ public function setServer($server) { $this->getResourceManager()->setServer($this->getResourceId(), $server); return $this; } /** * * * @param array $connectionOptions * * @return MongoDbOptions Provides a fluent interface */ public function setConnectionOptions(array $connectionOptions) { $this->getResourceManager()->setConnectionOptions($this->getResourceId(), $connectionOptions); return $this; } /** * * * @param array $driverOptions MongoDbOptions * @return MongoDbOptions Provides a fluent interface */ public function setDriverOptions(array $driverOptions) { $this->getResourceManager()->setDriverOptions($this->getResourceId(), $driverOptions); return $this; } /** * * * @param string $database * * @return MongoDbOptions Provides a fluent interface */ public function setDatabase($database) { $this->getResourceManager()->setDatabase($this->getResourceId(), $database); return $this; } /** * * * @param string $collection * * @return MongoDbOptions Provides a fluent interface */ public function setCollection($collection) { $this->getResourceManager()->setCollection($this->getResourceId(), $collection); return $this; } }