From 91f93ca8a03e5748f71cd865141ed96a2aa925fc Mon Sep 17 00:00:00 2001 From: _alvian Date: Wed, 6 Dec 2017 10:12:19 +0700 Subject: [PATCH] Add connectionHandler and export params --- Connection.php | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Connection.php b/Connection.php index 63fd183..b68c6aa 100644 --- a/Connection.php +++ b/Connection.php @@ -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() { @@ -51,13 +55,14 @@ class Connection extends BaseObject try { Yii::info($token, 'explosivebit\arangodb\Connection::open'); Yii::beginProfile($token, 'explosivebit\arangodb\Connection::open'); - $this->connection = new \ArangoDBClient\Connection($this->connectionOptions); + $this->connection = new \ArangoDBClient\Connection($this->connectionOptions); $this->collectionHandler = new CollectionHandler($this->connection); - $this->documentHandler = new DocumentHandler($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); + } +}