Use imports instead of FQNs

This commit is contained in:
Jan Böhmer 2023-06-11 14:55:06 +02:00
parent f63b6d7207
commit 5629215ce4
179 changed files with 792 additions and 597 deletions

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Command\Migrations;
use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\ProjectSystem\Project;
@ -47,7 +48,7 @@ use function count;
/**
* This command converts the BBCode used by old Part-DB versions (<1.0), to the current used Markdown format.
*/
#[\Symfony\Component\Console\Attribute\AsCommand('partdb:migrations:convert-bbcode|app:convert-bbcode', 'Converts BBCode used in old Part-DB versions to newly used Markdown')]
#[AsCommand('partdb:migrations:convert-bbcode|app:convert-bbcode', 'Converts BBCode used in old Part-DB versions to newly used Markdown')]
class ConvertBBCodeCommand extends Command
{
/**
@ -159,6 +160,6 @@ class ConvertBBCodeCommand extends Command
$io->success('Changes saved to DB successfully!');
}
return \Symfony\Component\Console\Command\Command::SUCCESS;
return Command::SUCCESS;
}
}

View file

@ -20,6 +20,7 @@
namespace App\Command\Migrations;
use Symfony\Component\Console\Attribute\AsCommand;
use App\Services\ImportExportSystem\PartKeeprImporter\PKDatastructureImporter;
use App\Services\ImportExportSystem\PartKeeprImporter\MySQLDumpXMLConverter;
use App\Services\ImportExportSystem\PartKeeprImporter\PKImportHelper;
@ -33,7 +34,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[\Symfony\Component\Console\Attribute\AsCommand('partdb:migrations:import-partkeepr', 'Import a PartKeepr database XML dump into Part-DB')]
#[AsCommand('partdb:migrations:import-partkeepr', 'Import a PartKeepr database XML dump into Part-DB')]
class ImportPartKeeprCommand extends Command
{
@ -85,7 +86,7 @@ class ImportPartKeeprCommand extends Command
if (!$this->importHelper->checkVersion($data)) {
$db_version = $this->importHelper->getDatabaseSchemaVersion($data);
$io->error('The version of the imported database is not supported! (Version: '.$db_version.')');
return \Symfony\Component\Console\Command\Command::FAILURE;
return Command::FAILURE;
}
//Import the mandatory data
@ -103,7 +104,7 @@ class ImportPartKeeprCommand extends Command
$io->success('Imported '.$count.' users.');
}
return \Symfony\Component\Console\Command\Command::SUCCESS;
return Command::SUCCESS;
}
private function doImport(SymfonyStyle $io, array $data): void