refactoring
This commit is contained in:
parent
a3a51c9c10
commit
9f02264965
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveQueryInterface;
|
||||
|
@ -104,14 +104,14 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
|||
{
|
||||
$statement = $this->createCommand($db);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
$cursor = $statement->execute();
|
||||
$rows = $cursor->getAll();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
if (!empty($rows)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Time: 16:00
|
||||
*/
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use yii\base\Object;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use Yii;
|
||||
use triagens\ArangoDb\CollectionHandler;
|
||||
|
@ -49,14 +49,14 @@ class Connection extends Object
|
|||
|
||||
$token = 'Opening ArangoDB connection: ' . $this->connectionOptions[ConnectionOptions::OPTION_ENDPOINT];
|
||||
try {
|
||||
Yii::info($token, 'devgroup\arangodb\Connection::open');
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Connection::open');
|
||||
Yii::info($token, 'explosivebit\arangodb\Connection::open');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Connection::open');
|
||||
$this->connection = new \triagens\ArangoDb\Connection($this->connectionOptions);
|
||||
$this->collectionHandler = new CollectionHandler($this->connection);
|
||||
$this->documentHandler = new DocumentHandler($this->connection);
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Connection::open');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Connection::open');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Connection::open');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
class Exception extends \yii\base\Exception
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use yii\base\Component;
|
||||
use yii\db\MigrationInterface;
|
||||
|
|
58
Query.php
58
Query.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use Yii;
|
||||
use triagens\ArangoDb\Document;
|
||||
|
@ -131,13 +131,13 @@ class Query extends Component implements QueryInterface
|
|||
$options = ArrayHelper::merge($params, $options);
|
||||
$statement = $this->getStatement($options);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
return $this->prepareResult($cursor->getAll());
|
||||
|
@ -619,13 +619,13 @@ class Query extends Component implements QueryInterface
|
|||
{
|
||||
$statement = $this->createCommand($db);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
return $this->prepareResult($cursor->getAll());
|
||||
|
@ -641,13 +641,13 @@ class Query extends Component implements QueryInterface
|
|||
$this->limit(1);
|
||||
$statement = $this->createCommand($db);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
$result = $this->prepareResult($cursor->getAll());
|
||||
|
@ -682,13 +682,13 @@ class Query extends Component implements QueryInterface
|
|||
|
||||
$statement = $this->getStatement($params, $db);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::insert');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::insert');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::insert');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::insert');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::insert');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::insert');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::insert');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::insert');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
return true;
|
||||
|
@ -725,13 +725,13 @@ class Query extends Component implements QueryInterface
|
|||
|
||||
$statement = $this->getStatement($params, $db);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::update');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::update');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::update');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::update');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::update');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::update');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::update');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::update');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
$meta = $cursor->getMetadata();
|
||||
|
@ -770,13 +770,13 @@ class Query extends Component implements QueryInterface
|
|||
|
||||
$statement = $this->getStatement($params, $db);
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::remove');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::remove');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::remove');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::remove');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::remove');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::remove');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::remove');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::remove');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
$meta = $cursor->getMetadata();
|
||||
|
@ -859,13 +859,13 @@ class Query extends Component implements QueryInterface
|
|||
$statement->setBatchSize(1);
|
||||
|
||||
$token = $this->getRawAql($statement);
|
||||
Yii::info($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::info($token, 'explosivebit\arangodb\Query::query');
|
||||
try {
|
||||
Yii::beginProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::beginProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
$cursor = $statement->execute();
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::endProfile($token, 'devgroup\arangodb\Query::query');
|
||||
Yii::endProfile($token, 'explosivebit\arangodb\Query::query');
|
||||
throw new \Exception($ex->getMessage(), (int) $ex->getCode(), $ex);
|
||||
}
|
||||
return $cursor->getFullCount();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Time: 16:04
|
||||
*/
|
||||
|
||||
namespace devgroup\arangodb;
|
||||
namespace explosivebit\arangodb;
|
||||
|
||||
use yii\base\Arrayable;
|
||||
|
||||
|
|
|
@ -6,16 +6,8 @@
|
|||
"license": "GPL-3.0+",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alexander Kozhevnikov",
|
||||
"email": "b37hr3z3n@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Evgeny Dubovitsky",
|
||||
"email": "flynn068@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Pavel Fedotov",
|
||||
"email": "fps.06@mail.ru"
|
||||
"name": "Ilya Rumyantsev",
|
||||
"email": "explosivebit@gmail.com"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
|
@ -28,7 +20,7 @@
|
|||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"devgroup\\arangodb\\": ""
|
||||
"explosivebit\\arangodb\\": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb\console\controllers;
|
||||
namespace explosivebit\arangodb\console\controllers;
|
||||
|
||||
use devgroup\arangodb\Connection;
|
||||
use devgroup\arangodb\Exception;
|
||||
use devgroup\arangodb\Migration;
|
||||
use devgroup\arangodb\Query;
|
||||
use explosivebit\arangodb\Connection;
|
||||
use explosivebit\arangodb\Exception;
|
||||
use explosivebit\arangodb\Migration;
|
||||
use explosivebit\arangodb\Query;
|
||||
|
||||
use yii;
|
||||
use yii\console\controllers\BaseMigrateController;
|
||||
|
@ -25,7 +25,7 @@ class MigrateController extends BaseMigrateController
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $templateFile = '@devgroup/arangodb/views/migration.php';
|
||||
public $templateFile = '@explosivebit/arangodb/views/migration.php';
|
||||
/**
|
||||
* @var Connection|string the DB connection object or the application
|
||||
* component ID of the DB connection.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb\panels\arangodb;
|
||||
namespace explosivebit\arangodb\panels\arangodb;
|
||||
|
||||
use devgroup\arangodb\panels\arangodb\models\ArangoDb;
|
||||
use explosivebit\arangodb\panels\arangodb\models\ArangoDb;
|
||||
use Yii;
|
||||
use yii\debug\Panel;
|
||||
use yii\log\Logger;
|
||||
|
@ -31,11 +31,11 @@ class ArangoDbPanel extends Panel
|
|||
$target->messages,
|
||||
Logger::LEVEL_PROFILE,
|
||||
[
|
||||
'devgroup\arangodb\Query::query',
|
||||
'devgroup\arangodb\Query::insert',
|
||||
'devgroup\arangodb\Query::update',
|
||||
'devgroup\arangodb\Query::remove',
|
||||
'devgroup\arangodb\Query::execute',
|
||||
'explosivebit\arangodb\Query::query',
|
||||
'explosivebit\arangodb\Query::insert',
|
||||
'explosivebit\arangodb\Query::update',
|
||||
'explosivebit\arangodb\Query::remove',
|
||||
'explosivebit\arangodb\Query::execute',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class ArangoDbPanel extends Panel
|
|||
$queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms';
|
||||
|
||||
return \Yii::$app->view->render(
|
||||
'@devgroup/arangodb/panels/arangodb/views/summary',
|
||||
'@explosivebit/arangodb/panels/arangodb/views/summary',
|
||||
[
|
||||
'timings' => $this->calculateTimings(),
|
||||
'queryCount' => $queryCount,
|
||||
|
@ -101,7 +101,7 @@ class ArangoDbPanel extends Panel
|
|||
$searchModel = new ArangoDb();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels());
|
||||
|
||||
return Yii::$app->view->render('@devgroup/arangodb/panels/arangodb/views/detail', [
|
||||
return Yii::$app->view->render('@explosivebit/arangodb/panels/arangodb/views/detail', [
|
||||
'panel' => $this,
|
||||
'dataProvider' => $dataProvider,
|
||||
'searchModel' => $searchModel,
|
||||
|
@ -136,15 +136,15 @@ class ArangoDbPanel extends Panel
|
|||
|
||||
protected function getQueryType($category) {
|
||||
switch ($category) {
|
||||
case 'devgroup\arangodb\Query::query' :
|
||||
case 'explosivebit\arangodb\Query::query' :
|
||||
return 'SELECT';
|
||||
case 'devgroup\arangodb\Query::insert' :
|
||||
case 'explosivebit\arangodb\Query::insert' :
|
||||
return 'INSERT';
|
||||
case 'devgroup\arangodb\Query::update' :
|
||||
case 'explosivebit\arangodb\Query::update' :
|
||||
return 'UPDATE';
|
||||
case 'devgroup\arangodb\Query::remove' :
|
||||
case 'explosivebit\arangodb\Query::remove' :
|
||||
return 'REMOVE';
|
||||
case 'devgroup\arangodb\Query::execute' :
|
||||
case 'explosivebit\arangodb\Query::execute' :
|
||||
return 'EXECUTE';
|
||||
default :
|
||||
return '';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace devgroup\arangodb\panels\arangodb\models;
|
||||
namespace explosivebit\arangodb\panels\arangodb\models;
|
||||
|
||||
use yii;
|
||||
use yii\data\ArrayDataProvider;
|
||||
|
|
|
@ -12,13 +12,11 @@ class <?= $className ?> extends \devgroup\arangodb\Migration
|
|||
{
|
||||
public function up()
|
||||
{
|
||||
|
||||
$this->createCollection('<?= $className ?>',[]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "<?= $className ?> cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
$this->dropCollection('<?= $className ?>');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue