2016-04-12 00:46:44 +03:00
|
|
|
<?php
|
2016-11-15 22:45:30 +03:00
|
|
|
namespace console\controllers;
|
2016-04-12 00:46:44 +03:00
|
|
|
|
2016-08-16 01:27:18 +03:00
|
|
|
use Ely\Amqp\ControllerTrait;
|
|
|
|
use Yii;
|
|
|
|
use yii\console\Controller;
|
|
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
use yii\helpers\Inflector;
|
2016-04-12 00:46:44 +03:00
|
|
|
|
|
|
|
abstract class AmqpController extends Controller {
|
2016-08-16 01:27:18 +03:00
|
|
|
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 00:46:44 +03:00
|
|
|
|
|
|
|
}
|