From 2063d7daa08f08bb4db1e0ac677db662c60ed8db Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sun, 17 Jul 2016 19:13:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B4=D0=BB=D1=8F=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=BA=D0=BE=D0=BC=D0=BF=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D0=B0=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B5,?= =?UTF-8?q?=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA?= =?UTF-8?q?=20di=20=D0=B4=D0=BB=D1=8F=20=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=B3=D0=BE=20=D0=B0=D0=BD=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controllers/OauthController.php | 4 +-- autocompletion.php | 42 +++++++++++++++++++++++ common/components/RabbitMQ/Controller.php | 2 +- common/components/RabbitMQ/Helper.php | 2 +- common/components/redis/Key.php | 2 +- common/components/redis/Set.php | 2 +- common/config/main.php | 8 ++--- 7 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 autocompletion.php diff --git a/api/controllers/OauthController.php b/api/controllers/OauthController.php index a74d33e..2ce9dd7 100644 --- a/api/controllers/OauthController.php +++ b/api/controllers/OauthController.php @@ -48,9 +48,7 @@ class OauthController extends Controller { * @return \League\OAuth2\Server\AuthorizationServer */ protected function getServer() { - /** @var \common\components\oauth\Component $oauth */ - $oauth = Yii::$app->get('oauth'); - return $oauth->authServer; + return Yii::$app->oauth->authServer; } /** diff --git a/autocompletion.php b/autocompletion.php new file mode 100644 index 0000000..687064e --- /dev/null +++ b/autocompletion.php @@ -0,0 +1,42 @@ +get('amqp'); + return Yii::$app->amqp; } /** diff --git a/common/components/RabbitMQ/Helper.php b/common/components/RabbitMQ/Helper.php index 7446cff..e3b5f7a 100644 --- a/common/components/RabbitMQ/Helper.php +++ b/common/components/RabbitMQ/Helper.php @@ -9,7 +9,7 @@ class Helper { * @return Component $amqp */ public static function getInstance() { - return Yii::$app->get('amqp'); + return Yii::$app->amqp; } public static function sendToExchange($exchange, $routingKey, $message, $exchangeArgs = []) { diff --git a/common/components/redis/Key.php b/common/components/redis/Key.php index aaea4ff..0455ce6 100644 --- a/common/components/redis/Key.php +++ b/common/components/redis/Key.php @@ -12,7 +12,7 @@ class Key { * @return \yii\redis\Connection */ public function getRedis() { - return Yii::$app->get('redis'); + return Yii::$app->redis; } public function getKey() { diff --git a/common/components/redis/Set.php b/common/components/redis/Set.php index 9dde932..80f8d0a 100644 --- a/common/components/redis/Set.php +++ b/common/components/redis/Set.php @@ -10,7 +10,7 @@ class Set extends Key implements IteratorAggregate { * @return \yii\redis\Connection */ public static function getDb() { - return Yii::$app->get('redis'); + return Yii::$app->redis; } public function add($value) { diff --git a/common/config/main.php b/common/config/main.php index 0722b11..1303616 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -3,21 +3,21 @@ return [ 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', 'components' => [ 'cache' => [ - 'class' => 'yii\caching\FileCache', + 'class' => yii\caching\FileCache::class, ], 'db' => [ - 'class' => 'yii\db\Connection', + 'class' => yii\db\Connection::class, 'charset' => 'utf8', ], 'mailer' => [ - 'class' => 'yii\swiftmailer\Mailer', + 'class' => yii\swiftmailer\Mailer::class, 'viewPath' => '@common/mail', ], 'security' => [ 'passwordHashStrategy' => 'password_hash', ], 'redis' => [ - 'class' => 'yii\redis\Connection', + 'class' => yii\redis\Connection::class, ], 'amqp' => [ 'class' => \common\components\RabbitMQ\Component::class,