diff --git a/PHPCI/Command/CreateAdminCommand.php b/PHPCI/Command/CreateAdminCommand.php index 265f03b4..dd92e529 100644 --- a/PHPCI/Command/CreateAdminCommand.php +++ b/PHPCI/Command/CreateAdminCommand.php @@ -25,18 +25,18 @@ use Symfony\Component\Console\Output\OutputInterface; class CreateAdminCommand extends Command { /** - * @var UserStore + * @var UserService */ - protected $userStore; + protected $userService; /** - * @param UserStore $userStore + * @param UserService $userService */ - public function __construct(UserStore $userStore) + public function __construct(UserService $userService) { parent::__construct(); - $this->userStore = $userStore; + $this->userService = $userService; } protected function configure() @@ -53,8 +53,6 @@ class CreateAdminCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $userService = new UserService($this->userStore); - /** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */ $dialog = $this->getHelperSet()->get('dialog'); @@ -72,7 +70,7 @@ class CreateAdminCommand extends Command $adminPass = $dialog->askHiddenResponse($output, Lang::get('enter_password')); try { - $userService->createUser($adminName, $adminEmail, $adminPass, true); + $this->userService->createUser($adminName, $adminEmail, $adminPass, true); $output->writeln(Lang::get('user_created')); } catch (\Exception $e) { $output->writeln(sprintf('%s', Lang::get('failed_to_create'))); diff --git a/services.yml b/services.yml index 977a1792..8fe0bda6 100644 --- a/services.yml +++ b/services.yml @@ -37,9 +37,12 @@ services: application: class: PHPCI\Application arguments: [@config, @http.request, @http.response, @storage.user, @storage.project] - build: + service.build: class: PHPCI\Service\BuildService arguments: [@storage.build] + service.user: + class: PHPCI\Service\UserService + arguments: [@storage.user] console.application: class: Symfony\Component\Console\Application @@ -83,12 +86,12 @@ services: console.command.create_admin: class: PHPCI\Command\CreateAdminCommand arguments: - - @storage.user + - @service.user console.command.create_build: class: PHPCI\Command\CreateBuildCommand arguments: - @storage.project - - @build + - @service.build console.command.install: class: PHPCI\Command\InstallCommand console.command.generate: