21 Commits
1.0.1 ... 2.0.0

Author SHA1 Message Date
RedHood
fbed4c8f9a Инициализация composer 2021-01-19 21:24:40 +10:00
explosivebit
fe5ba29f09 Add rus lang 2017-12-22 13:52:34 +03:00
explosivebit
b833a36a9f Update RUS readme 2017-12-22 13:49:18 +03:00
explosivebit
528aa8d565 Merge pull request #2 from elfarqy/master
Resolve #11
2017-12-22 13:43:28 +03:00
_alvian
858e86bfab add graphHandler 2017-12-22 13:55:09 +07:00
_alvian
183b2c6343 fixing composer json 2017-12-11 10:51:07 +07:00
_alvian
cc0fc40e10 Merge remote-tracking branch 'upstream/master' 2017-12-06 10:19:17 +07:00
_alvian
91f93ca8a0 Add connectionHandler and export params 2017-12-06 10:12:19 +07:00
_alvian
d0649796c5 change deprecated object to baseobject 2017-11-10 15:33:59 +07:00
_alvian
75b00ccc59 fixing configuration in main 2017-10-09 14:16:41 +07:00
_alvian
addcb6ee18 fix config in main 2017-10-09 13:12:10 +07:00
_alvian
24ff4cd697 git fix name and dependencies 2017-10-09 13:07:44 +07:00
_alvian
7d44b5fa7b git fix class using in Query 2017-10-09 13:07:27 +07:00
_alvian
6ccd02730c fix import class in connection 2017-10-09 13:07:02 +07:00
_alvian
9c704db451 fixing connection use 2017-10-09 11:19:40 +07:00
_alvian
2f4c725b51 change composer package definition 2017-10-09 11:12:05 +07:00
_alvian
094e92df66 enhance query based on arangodb 3.2 2017-10-03 07:34:02 +07:00
_alvian
c4c9b29e88 enhance connection based on new class in arangodb php 2017-10-03 06:20:15 +07:00
explosivebit
ed85a8859f Merge pull request #1 from elfarqy/master
Translating readme changelog from russia to english.
2017-06-21 16:08:38 +03:00
elfarqy
f8db82e5b0 fixing typo 2017-06-21 09:19:14 +07:00
elfarqy
fc1ee326ab translating readme.md in english version 2017-06-21 09:17:51 +07:00
20 changed files with 143 additions and 39 deletions

View File

@@ -1,26 +1,36 @@
{ {
"name": "explosivebit/yii2-arangodb", "name": "mirzaev/yii2-arangodb",
"description": "Yii2 arangodb components", "description": "Yii2 ArangoDB",
"type": "yii2-extension", "type": "library",
"keywords": ["yii2","arangodb"], "license": "AGPL-3.0-or-later",
"license": "GPL-3.0+", "homepage": "https://git.hood.su/mirzaev/yii2-arangodb",
"authors": [ "authors": [
{ {
"name": "Ilya Rumyantsev", "name": "Arsen Mirzaev Tatyano-Muradovich",
"email": "explosivebit@gmail.com" "email": "red@hood.su",
"homepage": "https://hood.su/mirzaev",
"role": "Developer"
},
{
"homepage": "https://github.com/explosivebit/yii2-arangodb",
"role": "Old fork (abandoned)"
},
{
"homepage": "https://github.com/DevGroup-ru/yii2-arangodb",
"role": "Original repository (abandoned)"
} }
], ],
"minimum-stability": "dev",
"require": { "require": {
"yiisoft/yii2": "*", "php": "^8.0.0"
"triagens/arangodb": "*"
},
"require-dev": {
"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"
}
},
}

View File

@@ -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);
}
} }

View File

@@ -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;

View File

@@ -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 => '',
], ],
], ],
], ],

View File

@@ -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');
}
}
``` ```

View File

@@ -0,0 +1,30 @@
{
"name": "elfarqy/yii2-arangodb",
"description": "Yii2 arangodb components",
"type": "yii2-extension",
"keywords": ["yii2","arangodb"],
"license": "GPL-3.0+",
"authors": [
{
"name": "Ilya Rumyantsev",
"email": "explosivebit@gmail.com"
},
{
"name": "Alvian Burhanuddin",
"email": "alvianthelfarqy@gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
"triagens/arangodb": "~3.2"
},
"require-dev": {
"yiisoft/yii2-debug": "*"
},
"autoload": {
"psr-4": {
"explosivebit\\arangodb\\": ""
}
}
}