1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
/** |
4
|
|
|
* /src/Command/User/ManagementCommand.php |
5
|
|
|
* |
6
|
|
|
* @author TLe, Tarmo Leppänen <[email protected]> |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace App\Command\User; |
10
|
|
|
|
11
|
|
|
use App\Command\Traits\ExecuteMultipleCommandTrait; |
12
|
|
|
use Symfony\Component\Console\Attribute\AsCommand; |
13
|
|
|
use Symfony\Component\Console\Command\Command; |
14
|
|
|
use Symfony\Component\Console\Exception\LogicException; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class ManagementCommand |
18
|
|
|
* |
19
|
|
|
* @package App\Command\User |
20
|
|
|
* @author TLe, Tarmo Leppänen <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
#[AsCommand( |
23
|
|
|
name: 'user:management', |
24
|
|
|
description: 'Console command to manage users and user groups', |
25
|
|
|
)] |
26
|
|
|
class ManagementCommand extends Command |
27
|
|
|
{ |
28
|
|
|
use ExecuteMultipleCommandTrait; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* ManagementCommand constructor. |
32
|
|
|
* |
33
|
|
|
* @throws LogicException |
34
|
|
|
*/ |
35
|
|
|
public function __construct() |
36
|
|
|
{ |
37
|
|
|
parent::__construct(); |
38
|
|
|
|
39
|
|
|
$this->setChoices([ |
40
|
|
|
ListUsersCommand::NAME => 'List users', |
41
|
|
|
ListUserGroupsCommand::NAME => 'List user groups', |
42
|
|
|
CreateUserCommand::NAME => 'Create user', |
43
|
|
|
CreateUserGroupCommand::NAME => 'Create user group', |
44
|
|
|
EditUserCommand::NAME => 'Edit user', |
45
|
|
|
EditUserGroupCommand::NAME => 'Edit user group', |
46
|
|
|
RemoveUserCommand::NAME => 'Remove user', |
47
|
|
|
RemoveUserGroupCommand::NAME => 'Remove user group', |
48
|
|
|
'0' => 'Exit', |
49
|
|
|
]); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|