Browse Source

Console user controller service handler

master
Egorka 5 years ago
parent
commit
31fe7fe57e
  1. 8
      console/controllers/UserController.php

8
console/controllers/UserController.php

@ -16,12 +16,12 @@ use Yii;
class UserController extends Controller class UserController extends Controller
{ {
private $_service; private $service;
public function __construct($id, $module, UserManageService $service, $config = []) public function __construct($id, $module, UserManageService $service, $config = [])
{ {
parent::__construct($id, $module, $config); parent::__construct($id, $module, $config);
$this->_service = $service; $this->service = $service;
} }
public function actionAdd() public function actionAdd()
@ -38,7 +38,7 @@ class UserController extends Controller
$form->role = $role; $form->role = $role;
if ($form->validate()) { if ($form->validate()) {
$this->_service->create($form); $this->service->create($form);
$this->stdout('Done!' . PHP_EOL); $this->stdout('Done!' . PHP_EOL);
return; return;
@ -59,7 +59,7 @@ class UserController extends Controller
$form->role = 'admin'; $form->role = 'admin';
if ($form->validate()) { if ($form->validate()) {
$this->_service->create($form); $this->service->create($form);
return; return;
} }
} }

Loading…
Cancel
Save