diff --git a/src/Console/BackupDatabase.php b/src/Console/BackupDatabaseCommand.php similarity index 80% rename from src/Console/BackupDatabase.php rename to src/Console/BackupDatabaseCommand.php index 9496625..1abbcd6 100644 --- a/src/Console/BackupDatabase.php +++ b/src/Console/BackupDatabaseCommand.php @@ -5,19 +5,20 @@ namespace App\Console; use App\Service\BackupService; use App\Service\DatabaseService; use App\Service\Traits\SelectDatabaseQuestion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class BackupDatabase extends Command +#[AsCommand('db:backup')] +class BackupDatabaseCommand extends Command { use SelectDatabaseQuestion; - protected static $defaultName = 'db:backup'; - public function __construct( - private readonly BackupService $bs, + private readonly BackupService $bs, + private readonly DatabaseService $db, ) { parent::__construct(); diff --git a/src/Console/CreateDatabaseCommand.php b/src/Console/CreateDatabaseCommand.php index fa9db07..f9431db 100644 --- a/src/Console/CreateDatabaseCommand.php +++ b/src/Console/CreateDatabaseCommand.php @@ -3,16 +3,16 @@ namespace App\Console; use App\Service\DatabaseService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; +#[AsCommand('db:create')] class CreateDatabaseCommand extends Command { - protected static $defaultName = 'db:create'; - public function __construct( private DatabaseService $db, ) diff --git a/src/Console/DeleteDatabaseCommand.php b/src/Console/DeleteDatabaseCommand.php index 5d485ef..3fdbad8 100644 --- a/src/Console/DeleteDatabaseCommand.php +++ b/src/Console/DeleteDatabaseCommand.php @@ -4,17 +4,17 @@ namespace App\Console; use App\Service\DatabaseService; use App\Service\Traits\SelectDatabaseQuestion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand('db:delete')] class DeleteDatabaseCommand extends Command { use SelectDatabaseQuestion; - protected static $defaultName = 'db:delete'; - public function __construct( private DatabaseService $db, ) diff --git a/src/Console/ListDatabasesCommand.php b/src/Console/ListDatabasesCommand.php index 7063fa9..160ed80 100644 --- a/src/Console/ListDatabasesCommand.php +++ b/src/Console/ListDatabasesCommand.php @@ -3,14 +3,14 @@ namespace App\Console; use App\Service\DatabaseService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand('db:list')] class ListDatabasesCommand extends Command { - protected static $defaultName = 'db:list'; - public function __construct( private DatabaseService $db, ) diff --git a/src/Console/ListUsersCommand.php b/src/Console/ListUsersCommand.php index 1ebd936..6564884 100644 --- a/src/Console/ListUsersCommand.php +++ b/src/Console/ListUsersCommand.php @@ -3,14 +3,14 @@ namespace App\Console; use App\Service\DatabaseService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand('user:list')] class ListUsersCommand extends Command { - protected static $defaultName = 'user:list'; - public function __construct( private DatabaseService $db, ) diff --git a/src/Console/PurgeDatabaseCommand.php b/src/Console/PurgeDatabaseCommand.php index 196bc20..0a7f4b5 100644 --- a/src/Console/PurgeDatabaseCommand.php +++ b/src/Console/PurgeDatabaseCommand.php @@ -4,17 +4,17 @@ namespace App\Console; use App\Service\DatabaseService; use App\Service\Traits\SelectDatabaseQuestion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand('db:purge')] class PurgeDatabaseCommand extends Command { use SelectDatabaseQuestion; - protected static $defaultName = 'db:purge'; - public function __construct( private DatabaseService $db, ) diff --git a/src/Console/RestoreDatabase.php b/src/Console/RestoreDatabaseCommand.php similarity index 92% rename from src/Console/RestoreDatabase.php rename to src/Console/RestoreDatabaseCommand.php index 5f7c220..b1272d8 100644 --- a/src/Console/RestoreDatabase.php +++ b/src/Console/RestoreDatabaseCommand.php @@ -5,6 +5,7 @@ namespace App\Console; use App\Service\BackupService; use App\Service\DatabaseService; use App\Service\Traits\SelectDatabaseQuestion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -12,12 +13,11 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Finder\Finder; -class RestoreDatabase extends Command +#[AsCommand('db:restore')] +class RestoreDatabaseCommand extends Command { use SelectDatabaseQuestion; - protected static $defaultName = 'db:restore'; - public function __construct( private DatabaseService $db, private BackupService $bs,