Update command to Attribute

This commit is contained in:
Tim 2022-09-28 13:30:21 +02:00
parent af30297d74
commit 55395666b7
7 changed files with 18 additions and 17 deletions

View File

@ -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();

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,