commit
528aa8d565
|
@ -2,17 +2,20 @@
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace explosivebit\arangodb;
|
||||||
|
|
||||||
|
use ArangoDBClient\EdgeHandler;
|
||||||
|
use ArangoDBClient\Export;
|
||||||
|
use ArangoDBClient\GraphHandler;
|
||||||
use Yii;
|
use Yii;
|
||||||
use triagens\ArangoDb\CollectionHandler;
|
use ArangoDBClient\CollectionHandler;
|
||||||
use triagens\ArangoDb\ConnectionOptions;
|
use ArangoDBClient\ConnectionOptions;
|
||||||
use triagens\ArangoDb\Document;
|
use ArangoDBClient\Document;
|
||||||
use triagens\ArangoDb\DocumentHandler;
|
use ArangoDBClient\DocumentHandler;
|
||||||
use triagens\ArangoDb\Statement;
|
use ArangoDBClient\Statement;
|
||||||
use triagens\ArangoDb\UpdatePolicy;
|
use ArangoDBClient\UpdatePolicy;
|
||||||
|
|
||||||
use yii\base\Object;
|
use yii\base\BaseObject;
|
||||||
|
|
||||||
class Connection extends Object
|
class Connection extends BaseObject
|
||||||
{
|
{
|
||||||
private $connection = null;
|
private $connection = null;
|
||||||
|
|
||||||
|
@ -42,6 +45,10 @@ class Connection extends Object
|
||||||
private $collectionHandler = null;
|
private $collectionHandler = null;
|
||||||
/** @var null|DocumentHandler $documentHandler */
|
/** @var null|DocumentHandler $documentHandler */
|
||||||
private $documentHandler = null;
|
private $documentHandler = null;
|
||||||
|
/** @var null|EdgeHandler $documentHandler */
|
||||||
|
private $edgeHandler = null;
|
||||||
|
/** @var null|EdgeHandler $graphHandler */
|
||||||
|
private $graphHandler = null;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
@ -51,16 +58,26 @@ class Connection extends Object
|
||||||
try {
|
try {
|
||||||
Yii::info($token, 'explosivebit\arangodb\Connection::open');
|
Yii::info($token, 'explosivebit\arangodb\Connection::open');
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Connection::open');
|
Yii::beginProfile($token, 'explosivebit\arangodb\Connection::open');
|
||||||
$this->connection = new \triagens\ArangoDb\Connection($this->connectionOptions);
|
$this->connection = new \ArangoDBClient\Connection($this->connectionOptions);
|
||||||
$this->collectionHandler = new CollectionHandler($this->connection);
|
$this->collectionHandler = new CollectionHandler($this->connection);
|
||||||
$this->documentHandler = new DocumentHandler($this->connection);
|
$this->documentHandler = new DocumentHandler($this->connection);
|
||||||
|
$this->edgeHandler = new EdgeHandler($this->connection);
|
||||||
|
$this->graphHandler = new GraphHandler($this->connection);
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EdgeHandler|null
|
||||||
|
*/
|
||||||
|
public function getGraphHandler(): EdgeHandler
|
||||||
|
{
|
||||||
|
return $this->graphHandler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return null|CollectionHandler
|
* @return null|CollectionHandler
|
||||||
*/
|
*/
|
||||||
|
@ -86,6 +103,14 @@ class Connection extends Object
|
||||||
return $this->documentHandler;
|
return $this->documentHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null|EdgeHandler
|
||||||
|
*/
|
||||||
|
public function getEdgeHandler()
|
||||||
|
{
|
||||||
|
return $this->edgeHandler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $collectionId
|
* @param $collectionId
|
||||||
* @param $documentId
|
* @param $documentId
|
||||||
|
@ -104,4 +129,12 @@ class Connection extends Object
|
||||||
{
|
{
|
||||||
return new Statement($this->connection, $options);
|
return new Statement($this->connection, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $options
|
||||||
|
* @return Export
|
||||||
|
*/
|
||||||
|
public function getExport($options = []) {
|
||||||
|
return new Export($this->connection, $options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace explosivebit\arangodb;
|
namespace explosivebit\arangodb;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use triagens\ArangoDb\Document;
|
use ArangoDBClient\Document;
|
||||||
use triagens\ArangoDb\Statement;
|
use ArangoDBClient\Statement;
|
||||||
use yii\base\Component;
|
use yii\base\Component;
|
||||||
use yii\base\InvalidParamException;
|
use yii\base\InvalidParamException;
|
||||||
use yii\base\NotSupportedException;
|
use yii\base\NotSupportedException;
|
||||||
|
|
10
README.md
10
README.md
|
@ -38,11 +38,11 @@ return [
|
||||||
'arangodb' => [
|
'arangodb' => [
|
||||||
'class' => '\explosivebit\arangodb\Connection',
|
'class' => '\explosivebit\arangodb\Connection',
|
||||||
'connectionOptions' => [
|
'connectionOptions' => [
|
||||||
triagens\ArangoDb\ConnectionOptions::OPTION_DATABASE => "mydatabase",
|
ArangoDBClient\ConnectionOptions::OPTION_DATABASE => "mydatabase",
|
||||||
triagens\ArangoDb\ConnectionOptions::OPTION_ENDPOINT => 'tcp://127.0.0.1:8529',
|
ArangoDBClient\ConnectionOptions::OPTION_ENDPOINT => 'tcp://127.0.0.1:8529',
|
||||||
triagens\ArangoDb\ConnectionOptions::OPTION_AUTH_TYPE => 'Basic',
|
ArangoDBClient\ConnectionOptions::OPTION_AUTH_TYPE => 'Basic',
|
||||||
//triagens\ArangoDb\ConnectionOptions::OPTION_AUTH_USER => '',
|
//ArangoDBClient\ConnectionOptions::OPTION_AUTH_USER => '',
|
||||||
//triagens\ArangoDb\ConnectionOptions::OPTION_AUTH_PASSWD => '',
|
//ArangoDBClient\ConnectionOptions::OPTION_AUTH_PASSWD => '',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "explosivebit/yii2-arangodb",
|
"name": "elfarqy/yii2-arangodb",
|
||||||
"description": "Yii2 arangodb components",
|
"description": "Yii2 arangodb components",
|
||||||
"type": "yii2-extension",
|
"type": "yii2-extension",
|
||||||
"keywords": ["yii2","arangodb"],
|
"keywords": ["yii2","arangodb"],
|
||||||
|
@ -8,12 +8,16 @@
|
||||||
{
|
{
|
||||||
"name": "Ilya Rumyantsev",
|
"name": "Ilya Rumyantsev",
|
||||||
"email": "explosivebit@gmail.com"
|
"email": "explosivebit@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Alvian Burhanuddin",
|
||||||
|
"email": "alvianthelfarqy@gmail.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"require": {
|
"require": {
|
||||||
"yiisoft/yii2": "*",
|
"yiisoft/yii2": "*",
|
||||||
"triagens/arangodb": "*"
|
"triagens/arangodb": "~3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-debug": "*"
|
"yiisoft/yii2-debug": "*"
|
||||||
|
@ -23,4 +27,4 @@
|
||||||
"explosivebit\\arangodb\\": ""
|
"explosivebit\\arangodb\\": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue