Add connectionHandler and export params

This commit is contained in:
_alvian 2017-12-06 10:12:19 +07:00
parent d0649796c5
commit 91f93ca8a0

View File

@ -2,6 +2,8 @@
namespace explosivebit\arangodb;
use ArangoDBClient\EdgeHandler;
use ArangoDBClient\Export;
use Yii;
use ArangoDBClient\CollectionHandler;
use ArangoDBClient\ConnectionOptions;
@ -42,6 +44,8 @@ class Connection extends BaseObject
private $collectionHandler = null;
/** @var null|DocumentHandler $documentHandler */
private $documentHandler = null;
/** @var null|EdgeHandler $documentHandler */
private $edgeHandler = null;
public function init()
{
@ -54,10 +58,11 @@ class Connection extends BaseObject
$this->connection = new \ArangoDBClient\Connection($this->connectionOptions);
$this->collectionHandler = new CollectionHandler($this->connection);
$this->documentHandler = new DocumentHandler($this->connection);
$this->edgeHandler = new EdgeHandler($this->connection);
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
} catch (\Exception $ex) {
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
throw new \Exception($ex->getMessage(), (int)$ex->getCode(), $ex);
}
}
@ -86,6 +91,14 @@ class Connection extends BaseObject
return $this->documentHandler;
}
/**
* @return null|EdgeHandler
*/
public function getEdgeHandler()
{
return $this->edgeHandler;
}
/**
* @param $collectionId
* @param $documentId
@ -104,5 +117,12 @@ class Connection extends BaseObject
{
return new Statement($this->connection, $options);
}
}
/**
* @param array $options
* @return Export
*/
public function getExport($options = []) {
return new Export($this->connection, $options);
}
}