accounts/console/controllers/base/AmqpController.php

36 lines
718 B
PHP

<?php
namespace console\controllers\base;
use Ely\Amqp\ControllerTrait;
use Yii;
use yii\console\Controller;
use yii\helpers\ArrayHelper;
use yii\helpers\Inflector;
abstract class AmqpController extends Controller {
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));
}
}