2016-04-12 03:16:44 +05:30
|
|
|
<?php
|
|
|
|
namespace console\controllers\base;
|
|
|
|
|
2016-08-16 03:57:18 +05:30
|
|
|
use Ely\Amqp\ControllerTrait;
|
|
|
|
use Yii;
|
|
|
|
use yii\console\Controller;
|
|
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
use yii\helpers\Inflector;
|
2016-04-12 03:16:44 +05:30
|
|
|
|
|
|
|
abstract class AmqpController extends Controller {
|
2016-08-16 03:57:18 +05:30
|
|
|
use ControllerTrait;
|
|
|
|
|
|
|
|
public final function actionIndex() {
|
|
|
|
$this->start();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRoutesMap() {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
protected function getConnection() {
|
|
|
|
return Yii::$app->amqp->getConnection();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
protected function buildRouteActionName($route) {
|
|
|
|
return ArrayHelper::getValue($this->getRoutesMap(), $route, 'route' . Inflector::camelize($route));
|
|
|
|
}
|
2016-04-12 03:16:44 +05:30
|
|
|
|
|
|
|
}
|