Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a4be42cc82 | ||
![]() |
b1f31103eb | ||
![]() |
6c308b92e7 | ||
![]() |
0dd8e7da47 | ||
![]() |
386f28c618 | ||
![]() |
fbed4c8f9a | ||
![]() |
fe5ba29f09 | ||
![]() |
b833a36a9f | ||
![]() |
528aa8d565 | ||
![]() |
858e86bfab | ||
![]() |
183b2c6343 | ||
![]() |
cc0fc40e10 | ||
![]() |
91f93ca8a0 | ||
![]() |
d0649796c5 | ||
![]() |
75b00ccc59 | ||
![]() |
addcb6ee18 | ||
![]() |
24ff4cd697 | ||
![]() |
7d44b5fa7b | ||
![]() |
6ccd02730c | ||
![]() |
9c704db451 | ||
![]() |
2f4c725b51 | ||
![]() |
094e92df66 | ||
![]() |
c4c9b29e88 | ||
![]() |
ed85a8859f | ||
![]() |
f8db82e5b0 | ||
![]() |
fc1ee326ab |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1 @@
|
|||||||
composer.phar
|
/vendor
|
||||||
composer.lock
|
|
||||||
vendor
|
|
@@ -1,26 +1,45 @@
|
|||||||
{
|
{
|
||||||
"name": "explosivebit/yii2-arangodb",
|
"name": "mirzaev/yii2-arangodb",
|
||||||
"description": "Yii2 arangodb components",
|
"description": "Library for connecting ArangoDB-PHP to Yii2",
|
||||||
|
"keywords": [
|
||||||
|
"Yii2",
|
||||||
|
"ArangoDB"
|
||||||
|
],
|
||||||
"type": "yii2-extension",
|
"type": "yii2-extension",
|
||||||
"keywords": ["yii2","arangodb"],
|
"license": "AGPL-3.0-or-later",
|
||||||
"license": "GPL-3.0+",
|
"homepage": "https://git.hood.su/mirzaev/yii2/arangodb",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Arsen Mirzaev Tatyano-Muradovich",
|
||||||
|
"email": "red@hood.su",
|
||||||
|
"homepage": "https://hood.su/mirzaev",
|
||||||
|
"role": "Developer"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Ilya Rumyantsev",
|
"name": "Ilya Rumyantsev",
|
||||||
"email": "explosivebit@gmail.com"
|
"email": "explosivebit@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Alvian Burhanuddin",
|
||||||
|
"email": "alvianthelfarqy@gmail.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"minimum-stability": "dev",
|
|
||||||
"require": {
|
"require": {
|
||||||
|
"php": "^8.0.0",
|
||||||
"yiisoft/yii2": "*",
|
"yiisoft/yii2": "*",
|
||||||
"triagens/arangodb": "*"
|
"triagens/arangodb": "~3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-debug": "*"
|
"yiisoft/yii2-debug": "*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"explosivebit\\arangodb\\": ""
|
"mirzaev\\yii2\\arangodb\\": "mirzaev/yii2-arangodb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"mirzaev\\yii2\\arangodb\\tests\\": "mirzaev/yii2-arangodb/tests"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\arangodb;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\db\ActiveQueryInterface;
|
use yii\db\ActiveQueryInterface;
|
||||||
@@ -104,14 +104,14 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
|||||||
{
|
{
|
||||||
$statement = $this->createCommand($db);
|
$statement = $this->createCommand($db);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
$rows = $cursor->getAll();
|
$rows = $cursor->getAll();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
if (!empty($rows)) {
|
if (!empty($rows)) {
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\arangodb;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\InvalidConfigException;
|
use yii\base\InvalidConfigException;
|
@@ -1,11 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* User: evgen-d
|
|
||||||
* Date: 08.10.14
|
|
||||||
* Time: 16:00
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\arangodb;
|
||||||
|
|
||||||
use yii\base\Object;
|
use yii\base\Object;
|
||||||
|
|
||||||
@@ -37,4 +32,3 @@ class AqlExpression extends Object
|
|||||||
return $this->expression;
|
return $this->expression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@@ -1,18 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\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()
|
||||||
{
|
{
|
||||||
@@ -49,18 +56,28 @@ class Connection extends Object
|
|||||||
|
|
||||||
$token = 'Opening ArangoDB connection: ' . $this->connectionOptions[ConnectionOptions::OPTION_ENDPOINT];
|
$token = 'Opening ArangoDB connection: ' . $this->connectionOptions[ConnectionOptions::OPTION_ENDPOINT];
|
||||||
try {
|
try {
|
||||||
Yii::info($token, 'explosivebit\arangodb\Connection::open');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Connection::open');
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Connection::open');
|
Yii::beginProfile($token, 'mirzaev\yii2\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);
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
$this->edgeHandler = new EdgeHandler($this->connection);
|
||||||
|
$this->graphHandler = new GraphHandler($this->connection);
|
||||||
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Connection::open');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
Yii::endProfile($token, 'mirzaev\yii2\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);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\arangodb;
|
||||||
|
|
||||||
class Exception extends \yii\base\Exception
|
class Exception extends \yii\base\Exception
|
||||||
{
|
{
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\arangodb;
|
||||||
|
|
||||||
use yii\base\Component;
|
use yii\base\Component;
|
||||||
use yii\db\MigrationInterface;
|
use yii\db\MigrationInterface;
|
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\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;
|
||||||
@@ -131,13 +131,13 @@ class Query extends Component implements QueryInterface
|
|||||||
$options = ArrayHelper::merge($params, $options);
|
$options = ArrayHelper::merge($params, $options);
|
||||||
$statement = $this->getStatement($options);
|
$statement = $this->getStatement($options);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
return $this->prepareResult($cursor->getAll());
|
return $this->prepareResult($cursor->getAll());
|
||||||
@@ -619,13 +619,13 @@ class Query extends Component implements QueryInterface
|
|||||||
{
|
{
|
||||||
$statement = $this->createCommand($db);
|
$statement = $this->createCommand($db);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
return $this->prepareResult($cursor->getAll());
|
return $this->prepareResult($cursor->getAll());
|
||||||
@@ -641,13 +641,13 @@ class Query extends Component implements QueryInterface
|
|||||||
$this->limit(1);
|
$this->limit(1);
|
||||||
$statement = $this->createCommand($db);
|
$statement = $this->createCommand($db);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
$result = $this->prepareResult($cursor->getAll());
|
$result = $this->prepareResult($cursor->getAll());
|
||||||
@@ -682,13 +682,13 @@ class Query extends Component implements QueryInterface
|
|||||||
|
|
||||||
$statement = $this->getStatement($params, $db);
|
$statement = $this->getStatement($params, $db);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::insert');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::insert');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::insert');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::insert');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::insert');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::insert');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::insert');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::insert');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -725,13 +725,13 @@ class Query extends Component implements QueryInterface
|
|||||||
|
|
||||||
$statement = $this->getStatement($params, $db);
|
$statement = $this->getStatement($params, $db);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::update');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::update');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::update');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::update');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::update');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::update');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::update');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::update');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
$meta = $cursor->getMetadata();
|
$meta = $cursor->getMetadata();
|
||||||
@@ -770,13 +770,13 @@ class Query extends Component implements QueryInterface
|
|||||||
|
|
||||||
$statement = $this->getStatement($params, $db);
|
$statement = $this->getStatement($params, $db);
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::remove');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::remove');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::remove');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::remove');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::remove');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::remove');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::remove');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::remove');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
$meta = $cursor->getMetadata();
|
$meta = $cursor->getMetadata();
|
||||||
@@ -859,13 +859,13 @@ class Query extends Component implements QueryInterface
|
|||||||
$statement->setBatchSize(1);
|
$statement->setBatchSize(1);
|
||||||
|
|
||||||
$token = $this->getRawAql($statement);
|
$token = $this->getRawAql($statement);
|
||||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
Yii::info($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
try {
|
try {
|
||||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::beginProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
$cursor = $statement->execute();
|
$cursor = $statement->execute();
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
Yii::endProfile($token, 'mirzaev\yii2\arangodb\Query::query');
|
||||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||||
}
|
}
|
||||||
return $cursor->getFullCount();
|
return $cursor->getFullCount();
|
@@ -36,11 +36,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,3 +1,6 @@
|
|||||||
|
[Описание на Русском](https://github.com/explosivebit/yii2-arangodb/blob/master/README.RU.md)
|
||||||
|
|
||||||
|
|
||||||
ArangoDb Extension for Yii 2
|
ArangoDb Extension for Yii 2
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
@@ -38,11 +41,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 => '',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -155,8 +158,36 @@ yii arangodb-migrate/create create_user_collection
|
|||||||
# applies ALL new migrations
|
# applies ALL new migrations
|
||||||
yii arangodb-migrate
|
yii arangodb-migrate
|
||||||
|
|
||||||
|
# Apply 1 migration
|
||||||
|
yii arangodb-migrate/up 1
|
||||||
|
|
||||||
# reverts the last applied migration
|
# reverts the last applied migration
|
||||||
yii arangodb-migrate/down
|
yii arangodb-migrate/down
|
||||||
|
|
||||||
|
# Rollback 1 migration
|
||||||
|
yii arangodb-migrate/down 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Once migration created, you can configure the migration:
|
||||||
|
|
||||||
|
When you start the migration as in the example below, you create a normal document collection with the migration name, you need to add an additional parameter `Type => 3` to create the `edge collection`. Example of such a query: `$this-> createCollection ('services', ['Type' => 3] );` If you want to create a document collection, then delete the `'Type' => 3` or replace the number 3 with 2.
|
||||||
|
|
||||||
|
|
||||||
|
```php
|
||||||
|
class m170413_210957_create_services_collection extends \explosivebit\arangodb\Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
# When you start the migration, a collection of "services" with the edge type is created
|
||||||
|
$this->createCollection('services',['Type' => 3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
# When the migration rollback starts, the collection "services"
|
||||||
|
$this->dropCollection('services');
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@@ -1,11 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* User: evgen-d
|
|
||||||
* Date: 08.10.14
|
|
||||||
* Time: 16:04
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace explosivebit\arangodb;
|
namespace mirzaev\yii2\arangodb;
|
||||||
|
|
||||||
use yii\base\Arrayable;
|
use yii\base\Arrayable;
|
||||||
|
|
||||||
@@ -56,4 +51,3 @@ class Serializer
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb\console\controllers;
|
namespace mirzaev\yii2\arangodb\console\controllers;
|
||||||
|
|
||||||
use explosivebit\arangodb\Connection;
|
use mirzaev\yii2\arangodb\Connection;
|
||||||
use explosivebit\arangodb\Exception;
|
use mirzaev\yii2\arangodb\Exception;
|
||||||
use explosivebit\arangodb\Migration;
|
use mirzaev\yii2\arangodb\Migration;
|
||||||
use explosivebit\arangodb\Query;
|
use mirzaev\yii2\arangodb\Query;
|
||||||
|
|
||||||
use yii;
|
use yii;
|
||||||
use yii\console\controllers\BaseMigrateController;
|
use yii\console\controllers\BaseMigrateController;
|
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb\panels\arangodb;
|
namespace mirzaev\yii2\arangodb\panels\arangodb;
|
||||||
|
|
||||||
use explosivebit\arangodb\panels\arangodb\models\ArangoDb;
|
use mirzaev\yii2\arangodb\panels\arangodb\models\ArangoDb;
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\debug\Panel;
|
use yii\debug\Panel;
|
||||||
use yii\log\Logger;
|
use yii\log\Logger;
|
||||||
@@ -31,11 +31,11 @@ class ArangoDbPanel extends Panel
|
|||||||
$target->messages,
|
$target->messages,
|
||||||
Logger::LEVEL_PROFILE,
|
Logger::LEVEL_PROFILE,
|
||||||
[
|
[
|
||||||
'explosivebit\arangodb\Query::query',
|
'mirzaev\yii2\arangodb\Query::query',
|
||||||
'explosivebit\arangodb\Query::insert',
|
'mirzaev\yii2\arangodb\Query::insert',
|
||||||
'explosivebit\arangodb\Query::update',
|
'mirzaev\yii2\arangodb\Query::update',
|
||||||
'explosivebit\arangodb\Query::remove',
|
'mirzaev\yii2\arangodb\Query::remove',
|
||||||
'explosivebit\arangodb\Query::execute',
|
'mirzaev\yii2\arangodb\Query::execute',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -136,15 +136,15 @@ class ArangoDbPanel extends Panel
|
|||||||
|
|
||||||
protected function getQueryType($category) {
|
protected function getQueryType($category) {
|
||||||
switch ($category) {
|
switch ($category) {
|
||||||
case 'explosivebit\arangodb\Query::query' :
|
case 'mirzaev\yii2\arangodb\Query::query' :
|
||||||
return 'SELECT';
|
return 'SELECT';
|
||||||
case 'explosivebit\arangodb\Query::insert' :
|
case 'mirzaev\yii2\arangodb\Query::insert' :
|
||||||
return 'INSERT';
|
return 'INSERT';
|
||||||
case 'explosivebit\arangodb\Query::update' :
|
case 'mirzaev\yii2\arangodb\Query::update' :
|
||||||
return 'UPDATE';
|
return 'UPDATE';
|
||||||
case 'explosivebit\arangodb\Query::remove' :
|
case 'mirzaev\yii2\arangodb\Query::remove' :
|
||||||
return 'REMOVE';
|
return 'REMOVE';
|
||||||
case 'explosivebit\arangodb\Query::execute' :
|
case 'mirzaev\yii2\arangodb\Query::execute' :
|
||||||
return 'EXECUTE';
|
return 'EXECUTE';
|
||||||
default :
|
default :
|
||||||
return '';
|
return '';
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace explosivebit\arangodb\panels\arangodb\models;
|
namespace mirzaev\yii2\arangodb\panels\arangodb\models;
|
||||||
|
|
||||||
use yii;
|
use yii;
|
||||||
use yii\data\ArrayDataProvider;
|
use yii\data\ArrayDataProvider;
|
@@ -8,7 +8,7 @@
|
|||||||
echo "<?php\n";
|
echo "<?php\n";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
class <?= $className ?> extends \explosivebit\arangodb\Migration
|
class <?= $className ?> extends \mirzaev\yii2\arangodb\Migration
|
||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
Reference in New Issue
Block a user