_connectionUri = "mongodb://$this->_host:$this->_port"; //Autenticazione mongoDB if ($connectionData['user'] && ['password']) { $this->_username = $connectionData['user']; $this->_password = $connectionData['password']; $this->_host = ($connectionData['host']) ? $connectionData['host'] : $this->_host; $this->_port = ($connectionData['port']) ? $connectionData['port'] : $this->_port; $mongoAuth = "$this->_username:$this->_password"; $mongoHost = "$this->_host:$this->_port"; //AuthMongoUri $this->_connectionUri = "mongodb://$mongoAuth@$mongoHost"; } if($connectionData['dbname']){ $this->_dbname = $connectionData['dbname']; } } /** * @return \MongoDB\Client */ public function getMongoClient(): \MongoDB\Client { if(!$this->_mongoClient){ $this->_mongoClient = new MongoDB\Client($this->_connectionUri); } return $this->_mongoClient; } /** * @return string|null */ public function getDbname(): string { return $this->_dbname; } /** * @param string $dbname */ public function setDbname(string $dbname): void { $this->_dbname = $dbname; Zend_Registry::set(self::MONGO_DB_ADAPTER_REG_NAME,$this); } }