Update symfony to 6.3 and upgrade some classes

This commit is contained in:
Tim 2023-09-29 11:01:38 +02:00
parent 4fd5aac51a
commit 017249474f
5 changed files with 439 additions and 306 deletions

View File

@ -8,15 +8,15 @@
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"ext-mysqli": "*", "ext-mysqli": "*",
"symfony/console": "6.2.*", "symfony/console": "6.3.*",
"symfony/dotenv": "6.2.*", "symfony/dotenv": "6.3.*",
"symfony/filesystem": "6.2.*", "symfony/filesystem": "6.3.*",
"symfony/finder": "6.2.*", "symfony/finder": "6.3.*",
"symfony/flex": "^1.3.1", "symfony/flex": "^1.3.1",
"symfony/framework-bundle": "6.2.*", "symfony/framework-bundle": "6.3.*",
"symfony/process": "6.2.*", "symfony/process": "6.3.*",
"symfony/runtime": "6.2.*", "symfony/runtime": "6.3.*",
"symfony/yaml": "6.2.*" "symfony/yaml": "6.3.*"
}, },
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
@ -62,7 +62,7 @@
"extra": { "extra": {
"symfony": { "symfony": {
"allow-contrib": false, "allow-contrib": false,
"require": "6.2.*" "require": "6.3.*"
} }
} }
} }

696
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -34,10 +34,19 @@ class RestoreDatabaseCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int protected function execute(InputInterface $input, OutputInterface $output): int
{ {
$question = $this->getHelper('question');
$db = $this->getDatabaseName($input, $output); $db = $this->getDatabaseName($input, $output);
$fileName = $input->getArgument('file'); $fileName = $input->getArgument('file');
if (!$fileName){ if (!$fileName){
$fileName = $this->getFileName($input, $output);
}
$this->bs->restore($db, $fileName);
return Command::SUCCESS;
}
private function getFileName(InputInterface $input, OutputInterface $output): string
{
$finder = new Finder(); $finder = new Finder();
$finder->in(__DIR__ . '/../..'); $finder->in(__DIR__ . '/../..');
$files = []; $files = [];
@ -46,11 +55,7 @@ class RestoreDatabaseCommand extends Command
} }
sort($files); sort($files);
$selectQuestion = new ChoiceQuestion('Backup name (*_backup.sql): ', $files); $selectQuestion = new ChoiceQuestion('Backup name (*_backup.sql): ', $files);
$fileName = $question->ask($input, $output, $selectQuestion); $question = $this->getHelper('question');
} return $question->ask($input, $output, $selectQuestion);
$this->bs->restore($db, $fileName);
return Command::SUCCESS;
} }
} }

View File

@ -8,7 +8,9 @@ use Symfony\Component\Process\Process;
class BackupService class BackupService
{ {
public function __construct(private DatabaseCredentials $credentials) public function __construct(
private readonly DatabaseCredentials $credentials
)
{ {
} }

View File

@ -10,7 +10,7 @@ class DatabaseService
private mysqli $conn; private mysqli $conn;
public function __construct( public function __construct(
private MysqliConnection $service private readonly MysqliConnection $service
) )
{ {
$this->conn = $this->service->getConnection(); $this->conn = $this->service->getConnection();