diff --git a/rector.php b/rector.php
index 04ab0e5a..b90d120a 100644
--- a/rector.php
+++ b/rector.php
@@ -14,6 +14,11 @@ return static function (RectorConfig $rectorConfig): void {
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml');
$rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php');
+ //Import class names instead of using fully qualified class names
+ $rectorConfig->importNames();
+ //But keep the fully qualified class names for classes in the global namespace
+ $rectorConfig->importShortClasses(false);
+
$rectorConfig->paths([
__DIR__ . '/config',
__DIR__ . '/public',
diff --git a/src/Command/Attachments/CleanAttachmentsCommand.php b/src/Command/Attachments/CleanAttachmentsCommand.php
index d0e37825..e9ffd286 100644
--- a/src/Command/Attachments/CleanAttachmentsCommand.php
+++ b/src/Command/Attachments/CleanAttachmentsCommand.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Command\Attachments;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Services\Attachments\AttachmentManager;
use App\Services\Attachments\AttachmentPathResolver;
use App\Services\Attachments\AttachmentReverseSearch;
@@ -40,7 +41,7 @@ use function count;
use const DIRECTORY_SEPARATOR;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')]
+#[AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')]
class CleanAttachmentsCommand extends Command
{
protected MimeTypes $mimeTypeGuesser;
@@ -99,7 +100,7 @@ class CleanAttachmentsCommand extends Command
if (!$continue) {
//We are finished here, when no files should be deleted
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
//Delete the files
@@ -112,7 +113,7 @@ class CleanAttachmentsCommand extends Command
$io->success('No abandoned files found.');
}
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
/**
diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php
index ccc5763e..d68afb67 100644
--- a/src/Command/BackupCommand.php
+++ b/src/Command/BackupCommand.php
@@ -2,6 +2,8 @@
namespace App\Command;
+use Symfony\Component\Console\Attribute\AsCommand;
+use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\ORM\EntityManagerInterface;
use PhpZip\Constants\ZipCompressionMethod;
@@ -16,7 +18,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:backup', 'Backup the files and the database of Part-DB')]
+#[AsCommand('partdb:backup', 'Backup the files and the database of Part-DB')]
class BackupCommand extends Command
{
public function __construct(private readonly string $project_dir, private readonly EntityManagerInterface $entityManager)
@@ -153,7 +155,7 @@ class BackupCommand extends Command
$io->error('Could not dump database: '.$e->getMessage());
$io->error('This can maybe be fixed by installing the mysqldump binary and adding it to the PATH variable!');
}
- } elseif ($connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
+ } elseif ($connection->getDatabasePlatform() instanceof SqlitePlatform) {
$io->note('SQLite database detected. Copy DB file to ZIP...');
$params = $connection->getParams();
$zip->addFile($params['path'], 'var/app.db');
diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php
index 38f599e3..a2fde8b9 100644
--- a/src/Command/CheckRequirementsCommand.php
+++ b/src/Command/CheckRequirementsCommand.php
@@ -20,6 +20,7 @@
namespace App\Command;
+use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -27,7 +28,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')]
+#[AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')]
class CheckRequirementsCommand extends Command
{
public function __construct(protected ContainerBagInterface $params)
diff --git a/src/Command/Currencies/UpdateExchangeRatesCommand.php b/src/Command/Currencies/UpdateExchangeRatesCommand.php
index 4a6b88f1..0f3eb11f 100644
--- a/src/Command/Currencies/UpdateExchangeRatesCommand.php
+++ b/src/Command/Currencies/UpdateExchangeRatesCommand.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Command\Currencies;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\PriceInformations\Currency;
use App\Services\Tools\ExchangeRateUpdater;
use Doctrine\ORM\EntityManagerInterface;
@@ -35,7 +36,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use function count;
use function strlen;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')]
+#[AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')]
class UpdateExchangeRatesCommand extends Command
{
public function __construct(protected string $base_current, protected EntityManagerInterface $em, protected ExchangeRateUpdater $exchangeRateUpdater)
@@ -56,7 +57,7 @@ class UpdateExchangeRatesCommand extends Command
if (3 !== strlen($this->base_current)) {
$io->error('Chosen Base current is not valid. Check your settings!');
- return \Symfony\Component\Console\Command\Command::FAILURE;
+ return Command::FAILURE;
}
$io->note('Update currency exchange rates with base currency: '.$this->base_current);
@@ -89,6 +90,6 @@ class UpdateExchangeRatesCommand extends Command
$io->success(sprintf('%d (of %d) currency exchange rates were updated.', $success_counter, count($candidates)));
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
}
diff --git a/src/Command/Logs/ShowEventLogCommand.php b/src/Command/Logs/ShowEventLogCommand.php
index 0fc78d46..2d11b359 100644
--- a/src/Command/Logs/ShowEventLogCommand.php
+++ b/src/Command/Logs/ShowEventLogCommand.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\Command\Logs;
+use Symfony\Component\Console\Attribute\AsCommand;
+use App\Entity\UserSystem\User;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Repository\LogEntryRepository;
@@ -36,7 +38,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\Translation\TranslatorInterface;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')]
+#[AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')]
class ShowEventLogCommand extends Command
{
protected LogEntryRepository $repo;
@@ -65,7 +67,7 @@ class ShowEventLogCommand extends Command
if ($page > $max_page && $max_page > 0) {
$io->error("There is no page ${page}! The maximum page is ${max_page}.");
- return \Symfony\Component\Console\Command\Command::FAILURE;
+ return Command::FAILURE;
}
$io->note("There are a total of ${total_count} log entries in the DB.");
@@ -75,14 +77,14 @@ class ShowEventLogCommand extends Command
$this->showPage($output, $desc, $limit, $page, $max_page, $showExtra);
if ($onePage) {
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
$continue = $io->confirm('Do you want to show the next page?');
++$page;
}
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
protected function configure(): void
@@ -136,7 +138,7 @@ class ShowEventLogCommand extends Command
$target_class = $this->elementTypeNameGenerator->getLocalizedTypeLabel($entry->getTargetClass());
}
- if ($entry->getUser() instanceof \App\Entity\UserSystem\User) {
+ if ($entry->getUser() instanceof User) {
$user = $entry->getUser()->getFullName(true);
} elseif ($entry->isCLIEntry()) {
$user = $entry->getCLIUsername() . ' [CLI]';
diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php
index 50e5b011..2297cbdd 100644
--- a/src/Command/Migrations/ConvertBBCodeCommand.php
+++ b/src/Command/Migrations/ConvertBBCodeCommand.php
@@ -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;
}
}
diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php
index 1ba2e8db..f1c7b47c 100644
--- a/src/Command/Migrations/ImportPartKeeprCommand.php
+++ b/src/Command/Migrations/ImportPartKeeprCommand.php
@@ -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
diff --git a/src/Command/User/ConvertToSAMLUserCommand.php b/src/Command/User/ConvertToSAMLUserCommand.php
index 4461bb58..d59b00a4 100644
--- a/src/Command/User/ConvertToSAMLUserCommand.php
+++ b/src/Command/User/ConvertToSAMLUserCommand.php
@@ -20,6 +20,7 @@
namespace App\Command\User;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\UserSystem\User;
use App\Security\SamlUserFactory;
use Doctrine\ORM\EntityManagerInterface;
@@ -30,7 +31,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:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')]
+#[AsCommand('partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')]
class ConvertToSAMLUserCommand extends Command
{
public function __construct(protected EntityManagerInterface $entityManager, protected bool $saml_enabled)
@@ -62,7 +63,7 @@ class ConvertToSAMLUserCommand extends Command
if (!$user) {
$io->error('User not found!');
- return \Symfony\Component\Console\Command\Command::FAILURE;
+ return Command::FAILURE;
}
$io->info('User found: '.$user->getFullName(true) . ': '.$user->getEmail().' [ID: ' . $user->getID() . ']');
diff --git a/src/Command/User/SetPasswordCommand.php b/src/Command/User/SetPasswordCommand.php
index 90f045b5..822277f1 100644
--- a/src/Command/User/SetPasswordCommand.php
+++ b/src/Command/User/SetPasswordCommand.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Command\User;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\UserSystem\User;
use App\Events\SecurityEvent;
use App\Events\SecurityEvents;
@@ -34,7 +35,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')]
+#[AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')]
class SetPasswordCommand extends Command
{
public function __construct(protected EntityManagerInterface $entityManager, protected UserPasswordHasherInterface $encoder, protected EventDispatcherInterface $eventDispatcher)
@@ -56,17 +57,17 @@ class SetPasswordCommand extends Command
$user = $this->entityManager->getRepository(User::class)->findByEmailOrName($user_name);
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
$io->error(sprintf('No user with the given username %s found in the database!', $user_name));
- return \Symfony\Component\Console\Command\Command::FAILURE;
+ return Command::FAILURE;
}
$io->note('User found!');
if ($user->isSamlUser()) {
$io->error('This user is a SAML user, so you can not change the password!');
- return \Symfony\Component\Console\Command\Command::FAILURE;
+ return Command::FAILURE;
}
$proceed = $io->confirm(
@@ -74,7 +75,7 @@ class SetPasswordCommand extends Command
$user->getFullName(true), $user->getID()));
if (!$proceed) {
- return \Symfony\Component\Console\Command\Command::FAILURE;
+ return Command::FAILURE;
}
$success = false;
@@ -105,6 +106,6 @@ class SetPasswordCommand extends Command
$security_event = new SecurityEvent($user);
$this->eventDispatcher->dispatch($security_event, SecurityEvents::PASSWORD_CHANGED);
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
}
diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php
index 219ddb2f..758a7903 100644
--- a/src/Command/User/UpgradePermissionsSchemaCommand.php
+++ b/src/Command/User/UpgradePermissionsSchemaCommand.php
@@ -20,6 +20,7 @@
namespace App\Command\User;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\PermissionData;
use App\Entity\UserSystem\User;
@@ -31,7 +32,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:upgrade-permissions-schema', '(Manually) upgrades the permissions schema of all users to the latest version.')]
+#[AsCommand('partdb:users:upgrade-permissions-schema', '(Manually) upgrades the permissions schema of all users to the latest version.')]
final class UpgradePermissionsSchemaCommand extends Command
{
public function __construct(private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $em, private readonly EventCommentHelper $eventCommentHelper)
@@ -74,7 +75,7 @@ final class UpgradePermissionsSchemaCommand extends Command
if ($groups_to_upgrade === [] && $users_to_upgrade === []) {
$io->success('All users and group permissions schemas are up-to-date. No update needed.');
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
//List all users and groups that need an update
@@ -86,7 +87,7 @@ final class UpgradePermissionsSchemaCommand extends Command
if(!$io->confirm('Continue with the update?', false)) {
$io->warning('Update aborted.');
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
//Update all users and groups
diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php
index ddb43513..182e8558 100644
--- a/src/Command/User/UserEnableCommand.php
+++ b/src/Command/User/UserEnableCommand.php
@@ -20,6 +20,7 @@
namespace App\Command\User;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\UserSystem\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
@@ -29,7 +30,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:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')]
+#[AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')]
class UserEnableCommand extends Command
{
public function __construct(protected EntityManagerInterface $entityManager, string $name = null)
@@ -66,7 +67,7 @@ class UserEnableCommand extends Command
} else { //Otherwise, fetch the users from DB
foreach ($usernames as $username) {
$user = $repo->findByEmailOrName($username);
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
$io->error('No user found with username: '.$username);
return self::FAILURE;
}
diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php
index 8a2265fd..cec70461 100644
--- a/src/Command/User/UserListCommand.php
+++ b/src/Command/User/UserListCommand.php
@@ -20,6 +20,8 @@
namespace App\Command\User;
+use Symfony\Component\Console\Attribute\AsCommand;
+use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
@@ -28,7 +30,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:list|users:list', 'Lists all users')]
+#[AsCommand('partdb:users:list|users:list', 'Lists all users')]
class UserListCommand extends Command
{
public function __construct(protected EntityManagerInterface $entityManager)
@@ -79,7 +81,7 @@ class UserListCommand extends Command
$user->getUsername(),
$user->getFullName(),
$user->getEmail(),
- $user->getGroup() instanceof \App\Entity\UserSystem\Group ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group',
+ $user->getGroup() instanceof Group ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group',
$user->isDisabled() ? 'Yes' : 'No',
$user->isSAMLUser() ? 'SAML' : 'Local',
]);
diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php
index 6be134ed..d78b0725 100644
--- a/src/Command/User/UsersPermissionsCommand.php
+++ b/src/Command/User/UsersPermissionsCommand.php
@@ -20,6 +20,7 @@
namespace App\Command\User;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Entity\UserSystem\User;
use App\Repository\UserRepository;
use App\Services\UserSystem\PermissionManager;
@@ -34,7 +35,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\Translation\TranslatorInterface;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:permissions|partdb:user:permissions', 'View and edit the permissions of a given user')]
+#[AsCommand('partdb:users:permissions|partdb:user:permissions', 'View and edit the permissions of a given user')]
class UsersPermissionsCommand extends Command
{
protected UserRepository $userRepository;
@@ -65,7 +66,7 @@ class UsersPermissionsCommand extends Command
//Find user
$io->note('Finding user with username: ' . $username);
$user = $this->userRepository->findByEmailOrName($username);
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
$io->error('No user found with username: ' . $username);
return Command::FAILURE;
}
diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php
index feecc6ee..76f7db70 100644
--- a/src/Command/VersionCommand.php
+++ b/src/Command/VersionCommand.php
@@ -20,6 +20,7 @@
namespace App\Command;
+use Symfony\Component\Console\Attribute\AsCommand;
use App\Services\Misc\GitVersionInfo;
use Shivas\VersioningBundle\Service\VersionManagerInterface;
use Symfony\Component\Console\Command\Command;
@@ -27,7 +28,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
-#[\Symfony\Component\Console\Attribute\AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')]
+#[AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')]
class VersionCommand extends Command
{
public function __construct(protected VersionManagerInterface $versionManager, protected GitVersionInfo $gitVersionInfo)
@@ -57,6 +58,6 @@ class VersionCommand extends Command
$io->info('OS: '. php_uname());
$io->info('PHP extension: '. implode(', ', get_loaded_extensions()));
- return \Symfony\Component\Console\Command\Command::SUCCESS;
+ return Command::SUCCESS;
}
}
\ No newline at end of file
diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php
index 8aaaf6f1..8fb35ae0 100644
--- a/src/Controller/AdminPages/BaseAdminController.php
+++ b/src/Controller/AdminPages/BaseAdminController.php
@@ -245,7 +245,7 @@ abstract class BaseAdminController extends AbstractController
protected function _new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AbstractNamedDBElement $entity = null)
{
- $new_entity = $entity instanceof \App\Entity\Base\AbstractNamedDBElement ? clone $entity : new $this->entity_class();
+ $new_entity = $entity instanceof AbstractNamedDBElement ? clone $entity : new $this->entity_class();
$this->denyAccessUnlessGranted('read', $new_entity);
diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php
index d74376ec..8f55b37c 100644
--- a/src/Controller/LabelController.php
+++ b/src/Controller/LabelController.php
@@ -73,11 +73,11 @@ class LabelController extends AbstractController
$this->denyAccessUnlessGranted('@labels.create_labels');
//If we inherit a LabelProfile, the user need to have access to it...
- if ($profile instanceof \App\Entity\LabelSystem\LabelProfile) {
+ if ($profile instanceof LabelProfile) {
$this->denyAccessUnlessGranted('read', $profile);
}
- $label_options = $profile instanceof \App\Entity\LabelSystem\LabelProfile ? $profile->getOptions() : new LabelOptions();
+ $label_options = $profile instanceof LabelProfile ? $profile->getOptions() : new LabelOptions();
//We have to disable the options, if twig mode is selected and user is not allowed to use it.
$disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig');
@@ -91,7 +91,7 @@ class LabelController extends AbstractController
$target_id = $request->query->get('target_id', null);
$generate = $request->query->getBoolean('generate', false);
- if (!$profile instanceof \App\Entity\LabelSystem\LabelProfile && is_string($target_type)) {
+ if (!$profile instanceof LabelProfile && is_string($target_type)) {
$label_options->setSupportedElement($target_type);
}
if (is_string($target_id)) {
@@ -108,7 +108,7 @@ class LabelController extends AbstractController
$filename = 'invalid.pdf';
//Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set
- if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile instanceof \App\Entity\LabelSystem\LabelProfile)) {
+ if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile instanceof LabelProfile)) {
$target_id = (string) $form->get('target_id')->getData();
$targets = $this->findObjects($form_options->getSupportedElement(), $target_id);
if ($targets !== []) {
diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php
index 2c6b6625..60fac14b 100644
--- a/src/Controller/LogController.php
+++ b/src/Controller/LogController.php
@@ -141,7 +141,7 @@ class LogController extends AbstractController
}
$log_element = $this->entityManager->find(AbstractLogEntry::class, $id);
- if (!$log_element instanceof \App\Entity\LogSystem\AbstractLogEntry) {
+ if (!$log_element instanceof AbstractLogEntry) {
throw new InvalidArgumentException('No log entry with the given ID is existing!');
}
diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php
index c10858ac..2434415e 100644
--- a/src/Controller/PartController.php
+++ b/src/Controller/PartController.php
@@ -210,13 +210,13 @@ class PartController extends AbstractController
?Part $part = null, ?Project $project = null): Response
{
- if ($part instanceof \App\Entity\Parts\Part) {
+ if ($part instanceof Part) {
//Clone part
$new_part = clone $part;
- } elseif ($project instanceof \App\Entity\ProjectSystem\Project) {
+ } elseif ($project instanceof Project) {
//Initialize a new part for a build part from the given project
//Ensure that the project has not already a build part
- if ($project->getBuildPart() instanceof \App\Entity\Parts\Part) {
+ if ($project->getBuildPart() instanceof Part) {
$this->addFlash('error', 'part.new_build_part.error.build_part_already_exists');
return $this->redirectToRoute('part_edit', ['id' => $project->getBuildPart()->getID()]);
}
@@ -229,7 +229,7 @@ class PartController extends AbstractController
$cid = $request->get('category', null);
$category = $cid ? $em->find(Category::class, $cid) : null;
- if ($category instanceof \App\Entity\Parts\Category && !$new_part->getCategory() instanceof \App\Entity\Parts\Category) {
+ if ($category instanceof Category && !$new_part->getCategory() instanceof Category) {
$new_part->setCategory($category);
$new_part->setDescription($category->getDefaultDescription());
$new_part->setComment($category->getDefaultComment());
@@ -237,19 +237,19 @@ class PartController extends AbstractController
$fid = $request->get('footprint', null);
$footprint = $fid ? $em->find(Footprint::class, $fid) : null;
- if ($footprint instanceof \App\Entity\Parts\Footprint && !$new_part->getFootprint() instanceof \App\Entity\Parts\Footprint) {
+ if ($footprint instanceof Footprint && !$new_part->getFootprint() instanceof Footprint) {
$new_part->setFootprint($footprint);
}
$mid = $request->get('manufacturer', null);
$manufacturer = $mid ? $em->find(Manufacturer::class, $mid) : null;
- if ($manufacturer instanceof \App\Entity\Parts\Manufacturer && !$new_part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer) {
+ if ($manufacturer instanceof Manufacturer && !$new_part->getManufacturer() instanceof Manufacturer) {
$new_part->setManufacturer($manufacturer);
}
$store_id = $request->get('storelocation', null);
$storelocation = $store_id ? $em->find(Storelocation::class, $store_id) : null;
- if ($storelocation instanceof \App\Entity\Parts\Storelocation && $new_part->getPartLots()->isEmpty()) {
+ if ($storelocation instanceof Storelocation && $new_part->getPartLots()->isEmpty()) {
$partLot = new PartLot();
$partLot->setStorageLocation($storelocation);
$partLot->setInstockUnknown(true);
@@ -258,7 +258,7 @@ class PartController extends AbstractController
$supplier_id = $request->get('supplier', null);
$supplier = $supplier_id ? $em->find(Supplier::class, $supplier_id) : null;
- if ($supplier instanceof \App\Entity\Parts\Supplier && $new_part->getOrderdetails()->isEmpty()) {
+ if ($supplier instanceof Supplier && $new_part->getOrderdetails()->isEmpty()) {
$orderdetail = new Orderdetail();
$orderdetail->setSupplier($supplier);
$new_part->addOrderdetail($orderdetail);
@@ -329,7 +329,7 @@ class PartController extends AbstractController
if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) {
//Retrieve partlot from the request
$partLot = $em->find(PartLot::class, $request->request->get('lot_id'));
- if(!$partLot instanceof \App\Entity\Parts\PartLot) {
+ if(!$partLot instanceof PartLot) {
throw new \RuntimeException('Part lot not found!');
}
//Ensure that the partlot belongs to the part
diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php
index a8fae5df..44e770e3 100644
--- a/src/Controller/ProjectController.php
+++ b/src/Controller/ProjectController.php
@@ -193,7 +193,7 @@ class ProjectController extends AbstractController
#[Route(path: '/{id}/add_parts', name: 'project_add_parts', requirements: ['id' => '\d+'])]
public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response
{
- if($project instanceof \App\Entity\ProjectSystem\Project) {
+ if($project instanceof Project) {
$this->denyAccessUnlessGranted('edit', $project);
} else {
$this->denyAccessUnlessGranted('@projects.edit');
@@ -203,7 +203,7 @@ class ProjectController extends AbstractController
$builder->add('project', StructuralEntityType::class, [
'class' => Project::class,
'required' => true,
- 'disabled' => $project instanceof \App\Entity\ProjectSystem\Project, //If a project is given, disable the field
+ 'disabled' => $project instanceof Project, //If a project is given, disable the field
'data' => $project,
'constraints' => [
new NotNull()
diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php
index 4ad6b772..480d5f58 100644
--- a/src/Controller/SecurityController.php
+++ b/src/Controller/SecurityController.php
@@ -71,7 +71,7 @@ class SecurityController extends AbstractController
* @return RedirectResponse|Response
*/
#[Route(path: '/pw_reset/request', name: 'pw_reset_request')]
- public function requestPwReset(PasswordResetManager $passwordReset, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
+ public function requestPwReset(PasswordResetManager $passwordReset, Request $request): RedirectResponse|Response
{
if (!$this->allow_email_pw_reset) {
throw new AccessDeniedHttpException('The password reset via email is disabled!');
@@ -114,7 +114,7 @@ class SecurityController extends AbstractController
* @return RedirectResponse|Response
*/
#[Route(path: '/pw_reset/new_pw/{user}/{token}', name: 'pw_reset_new_pw')]
- public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
+ public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null): RedirectResponse|Response
{
if (!$this->allow_email_pw_reset) {
throw new AccessDeniedHttpException('The password reset via email is disabled!');
diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php
index 3d8e9074..e7ce0b72 100644
--- a/src/Controller/TreeController.php
+++ b/src/Controller/TreeController.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Controller;
+use Symfony\Component\HttpFoundation\Response;
use App\Entity\ProjectSystem\Project;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
@@ -59,7 +60,7 @@ class TreeController extends AbstractController
if ($this->isGranted('@parts.read') && $this->isGranted('@categories.read')) {
$tree = $this->treeGenerator->getTreeView(Category::class, $category, 'list_parts_root');
} else {
- return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
+ return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}
return new JsonResponse($tree);
@@ -72,7 +73,7 @@ class TreeController extends AbstractController
if ($this->isGranted('@parts.read') && $this->isGranted('@footprints.read')) {
$tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint, 'list_parts_root');
} else {
- return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
+ return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}
return new JsonResponse($tree);
}
@@ -84,7 +85,7 @@ class TreeController extends AbstractController
if ($this->isGranted('@parts.read') && $this->isGranted('@storelocations.read')) {
$tree = $this->treeGenerator->getTreeView(Storelocation::class, $location, 'list_parts_root');
} else {
- return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
+ return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}
return new JsonResponse($tree);
@@ -97,7 +98,7 @@ class TreeController extends AbstractController
if ($this->isGranted('@parts.read') && $this->isGranted('@manufacturers.read')) {
$tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer, 'list_parts_root');
} else {
- return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
+ return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}
return new JsonResponse($tree);
@@ -110,7 +111,7 @@ class TreeController extends AbstractController
if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) {
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root');
} else {
- return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
+ return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}
return new JsonResponse($tree);
@@ -123,7 +124,7 @@ class TreeController extends AbstractController
if ($this->isGranted('@projects.read')) {
$tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices');
} else {
- return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
+ return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN);
}
return new JsonResponse($tree);
diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php
index 791cb793..3c0d76e9 100644
--- a/src/Controller/TypeaheadController.php
+++ b/src/Controller/TypeaheadController.php
@@ -22,6 +22,10 @@ declare(strict_types=1);
namespace App\Controller;
+use Symfony\Component\HttpFoundation\Response;
+use App\Entity\Attachments\Attachment;
+use App\Entity\Parts\Category;
+use App\Entity\Parts\Footprint;
use App\Entity\Parameters\AttachmentTypeParameter;
use App\Entity\Parameters\CategoryParameter;
use App\Entity\Parameters\ProjectParameter;
@@ -83,7 +87,7 @@ class TypeaheadController extends AbstractController
$serializer = new Serializer($normalizers, $encoders);
$data = $serializer->serialize($result, 'json');
- return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true);
+ return new JsonResponse($data, Response::HTTP_OK, [], true);
}
/**
@@ -122,7 +126,7 @@ class TypeaheadController extends AbstractController
foreach ($parts as $part) {
//Determine the picture to show:
$preview_attachment = $previewGenerator->getTablePreviewAttachment($part);
- if($preview_attachment instanceof \App\Entity\Attachments\Attachment) {
+ if($preview_attachment instanceof Attachment) {
$preview_url = $attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm');
} else {
$preview_url = '';
@@ -132,8 +136,8 @@ class TypeaheadController extends AbstractController
$data[] = [
'id' => $part->getID(),
'name' => $part->getName(),
- 'category' => $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : 'Unknown',
- 'footprint' => $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '',
+ 'category' => $part->getCategory() instanceof Category ? $part->getCategory()->getName() : 'Unknown',
+ 'footprint' => $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getName() : '',
'description' => mb_strimwidth($part->getDescription(), 0, 127, '...'),
'image' => $preview_url,
];
@@ -176,6 +180,6 @@ class TypeaheadController extends AbstractController
$serializer = new Serializer($normalizers, $encoders);
$data = $serializer->serialize($array, 'json');
- return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true);
+ return new JsonResponse($data, Response::HTTP_OK, [], true);
}
}
diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php
index ceb86802..9eb8cd23 100644
--- a/src/Controller/UserController.php
+++ b/src/Controller/UserController.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Controller;
+use App\Controller\AdminPages\BaseAdminController;
use App\DataTables\LogDataTable;
use App\Entity\Attachments\UserAttachment;
use App\Entity\Base\AbstractNamedDBElement;
@@ -47,7 +48,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: '/user')]
-class UserController extends AdminPages\BaseAdminController
+class UserController extends BaseAdminController
{
protected string $entity_class = User::class;
protected string $twig_template = 'admin/user_admin.html.twig';
@@ -180,7 +181,7 @@ class UserController extends AdminPages\BaseAdminController
public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response
{
//If no user id was passed, then we show info about the current user
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
$tmp = $this->getUser();
if (!$tmp instanceof User) {
throw new InvalidArgumentException('Userinfo only works for database users!');
diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php
index d21d0bbd..2d36d368 100644
--- a/src/Controller/UserSettingsController.php
+++ b/src/Controller/UserSettingsController.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Controller;
+use App\Entity\Attachments\Attachment;
use App\Entity\UserSystem\U2FKey;
use App\Entity\UserSystem\User;
use App\Entity\UserSystem\WebauthnKey;
@@ -118,7 +119,7 @@ class UserSettingsController extends AbstractController
$key_repo = $entityManager->getRepository(U2FKey::class);
/** @var U2FKey|null $u2f */
$u2f = $key_repo->find($key_id);
- if (!$u2f instanceof \App\Entity\UserSystem\U2FKey) {
+ if (!$u2f instanceof U2FKey) {
$this->addFlash('danger', 'tfa_u2f.u2f_delete.not_existing');
return $this->redirectToRoute('user_settings');
@@ -140,7 +141,7 @@ class UserSettingsController extends AbstractController
$key_repo = $entityManager->getRepository(WebauthnKey::class);
/** @var WebauthnKey|null $key */
$key = $key_repo->find($key_id);
- if (!$key instanceof \App\Entity\UserSystem\WebauthnKey) {
+ if (!$key instanceof WebauthnKey) {
$this->addFlash('error', 'tfa_u2f.u2f_delete.not_existing');
return $this->redirectToRoute('user_settings');
@@ -166,7 +167,7 @@ class UserSettingsController extends AbstractController
}
#[Route(path: '/invalidate_trustedDevices', name: 'tfa_trustedDevices_invalidate', methods: ['DELETE'])]
- public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager): \RuntimeException|\Symfony\Component\HttpFoundation\RedirectResponse
+ public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager): \RuntimeException|RedirectResponse
{
if ($this->demo_mode) {
throw new RuntimeException('You can not do 2FA things in demo mode');
@@ -203,7 +204,7 @@ class UserSettingsController extends AbstractController
* @return RedirectResponse|Response
*/
#[Route(path: '/settings', name: 'user_settings')]
- public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
+ public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper): RedirectResponse|Response
{
/** @var User $user */
$user = $this->getUser();
@@ -243,7 +244,7 @@ class UserSettingsController extends AbstractController
/** @var Form $form We need a form implementation for the next calls */
//Remove the avatar attachment from the user if requested
- if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName() && $user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) {
+ if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName() && $user->getMasterPictureAttachment() instanceof Attachment) {
$em->remove($user->getMasterPictureAttachment());
$user->setMasterPictureAttachment(null);
$page_need_reload = true;
diff --git a/src/DataTables/Column/EntityColumn.php b/src/DataTables/Column/EntityColumn.php
index c14eabe9..1636827a 100644
--- a/src/DataTables/Column/EntityColumn.php
+++ b/src/DataTables/Column/EntityColumn.php
@@ -64,7 +64,7 @@ class EntityColumn extends AbstractColumn
/** @var AbstractNamedDBElement|null $entity */
- if ($entity instanceof \App\Entity\Base\AbstractNamedDBElement) {
+ if ($entity instanceof AbstractNamedDBElement) {
if (null !== $entity->getID()) {
return sprintf(
'%s',
diff --git a/src/DataTables/Column/RevertLogColumn.php b/src/DataTables/Column/RevertLogColumn.php
index b61c0a87..a4d8eb3e 100644
--- a/src/DataTables/Column/RevertLogColumn.php
+++ b/src/DataTables/Column/RevertLogColumn.php
@@ -41,17 +41,17 @@ declare(strict_types=1);
namespace App\DataTables\Column;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\LogSystem\CollectionElementDeleted;
use App\Entity\LogSystem\ElementCreatedLogEntry;
use App\Entity\LogSystem\ElementDeletedLogEntry;
use App\Entity\LogSystem\ElementEditedLogEntry;
use Omines\DataTablesBundle\Column\AbstractColumn;
-use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class RevertLogColumn extends AbstractColumn
{
- public function __construct(protected TranslatorInterface $translator, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected TranslatorInterface $translator, protected Security $security)
{
}
diff --git a/src/DataTables/Filters/Constraints/EntityConstraint.php b/src/DataTables/Filters/Constraints/EntityConstraint.php
index 3fc002b3..2a17552d 100644
--- a/src/DataTables/Filters/Constraints/EntityConstraint.php
+++ b/src/DataTables/Filters/Constraints/EntityConstraint.php
@@ -41,9 +41,9 @@ class EntityConstraint extends AbstractConstraint
* @param null $value
* @param string $operator
*/
- public function __construct(protected ?\App\Services\Trees\NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '')
+ public function __construct(protected ?NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '')
{
- if (!$nodesListBuilder instanceof \App\Services\Trees\NodesListBuilder && $this->isStructural()) {
+ if (!$nodesListBuilder instanceof NodesListBuilder && $this->isStructural()) {
throw new \InvalidArgumentException('NodesListBuilder must be provided for structural entities');
}
@@ -128,7 +128,7 @@ class EntityConstraint extends AbstractConstraint
}
//We need to handle null values differently, as they can not be compared with == or !=
- if (!$this->value instanceof \App\Entity\Base\AbstractDBElement) {
+ if (!$this->value instanceof AbstractDBElement) {
if($this->operator === '=' || $this->operator === 'INCLUDING_CHILDREN') {
$queryBuilder->andWhere(sprintf("%s IS NULL", $this->property));
return;
diff --git a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php
index dfd15259..1c44255f 100644
--- a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php
+++ b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php
@@ -20,6 +20,7 @@
namespace App\DataTables\Filters\Constraints\Part;
+use Doctrine\ORM\Query\Expr\Orx;
use App\DataTables\Filters\Constraints\AbstractConstraint;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
@@ -88,7 +89,7 @@ class TagsConstraint extends AbstractConstraint
/**
* Builds an expression to query for a single tag
*/
- protected function getExpressionForTag(QueryBuilder $queryBuilder, string $tag): Expr\Orx
+ protected function getExpressionForTag(QueryBuilder $queryBuilder, string $tag): Orx
{
$tag_identifier_prefix = uniqid($this->identifier . '_', false);
diff --git a/src/DataTables/Filters/LogFilter.php b/src/DataTables/Filters/LogFilter.php
index 1751d565..416a9464 100644
--- a/src/DataTables/Filters/LogFilter.php
+++ b/src/DataTables/Filters/LogFilter.php
@@ -66,7 +66,7 @@ class LogFilter implements FilterInterface
/**
* @return IntConstraint|NumberConstraint
*/
- public function getDbId(): \App\DataTables\Filters\Constraints\IntConstraint|\App\DataTables\Filters\Constraints\NumberConstraint
+ public function getDbId(): IntConstraint|NumberConstraint
{
return $this->dbId;
}
diff --git a/src/DataTables/Helpers/PartDataTableHelper.php b/src/DataTables/Helpers/PartDataTableHelper.php
index 9e7c9686..df29f35b 100644
--- a/src/DataTables/Helpers/PartDataTableHelper.php
+++ b/src/DataTables/Helpers/PartDataTableHelper.php
@@ -20,6 +20,8 @@
namespace App\DataTables\Helpers;
+use App\Entity\ProjectSystem\Project;
+use App\Entity\Attachments\Attachment;
use App\Entity\Parts\Part;
use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\Attachments\PartPreviewGenerator;
@@ -46,7 +48,7 @@ class PartDataTableHelper
if ($context->isNeedsReview()) {
$icon = sprintf('', $this->translator->trans('part.needs_review.badge'));
}
- if ($context->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) {
+ if ($context->getBuiltProject() instanceof Project) {
$icon = sprintf('',
$this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName());
}
@@ -63,7 +65,7 @@ class PartDataTableHelper
public function renderPicture(Part $context): string
{
$preview_attachment = $this->previewGenerator->getTablePreviewAttachment($context);
- if (!$preview_attachment instanceof \App\Entity\Attachments\Attachment) {
+ if (!$preview_attachment instanceof Attachment) {
return '';
}
diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php
index 5bf3febc..3070e237 100644
--- a/src/DataTables/LogDataTable.php
+++ b/src/DataTables/LogDataTable.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\DataTables;
+use Symfony\Bundle\SecurityBundle\Security;
use App\DataTables\Column\IconLinkColumn;
use App\DataTables\Column\LocaleDateTimeColumn;
use App\DataTables\Column\LogEntryExtraColumn;
@@ -56,7 +57,6 @@ use Psr\Log\LogLevel;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class LogDataTable implements DataTableTypeInterface
@@ -65,7 +65,7 @@ class LogDataTable implements DataTableTypeInterface
public function __construct(protected ElementTypeNameGenerator $elementTypeNameGenerator, protected TranslatorInterface $translator,
protected UrlGeneratorInterface $urlGenerator, protected EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager,
- protected \Symfony\Bundle\SecurityBundle\Security $security, protected UserAvatarHelper $userAvatarHelper, protected LogLevelHelper $logLevelHelper)
+ protected Security $security, protected UserAvatarHelper $userAvatarHelper, protected LogLevelHelper $logLevelHelper)
{
$this->logRepo = $entityManager->getRepository(AbstractLogEntry::class);
}
@@ -158,7 +158,7 @@ class LogDataTable implements DataTableTypeInterface
$user = $context->getUser();
//If user was deleted, show the info from the username field
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
if ($context->isCLIEntry()) {
return sprintf('%s [%s]',
htmlentities($context->getCLIUsername()),
@@ -219,7 +219,7 @@ class LogDataTable implements DataTableTypeInterface
) {
try {
$target = $this->logRepo->getTargetElement($context);
- if ($target instanceof \App\Entity\Base\AbstractDBElement) {
+ if ($target instanceof AbstractDBElement) {
return $this->entityURLGenerator->timeTravelURL($target, $context->getTimestamp());
}
} catch (EntityNotSupportedException) {
diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php
index c1f8296c..82259cdd 100644
--- a/src/DataTables/PartsDataTable.php
+++ b/src/DataTables/PartsDataTable.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\DataTables;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\Parts\Storelocation;
use App\DataTables\Adapters\CustomFetchJoinORMAdapter;
use App\DataTables\Column\EntityColumn;
use App\DataTables\Column\IconLinkColumn;
@@ -49,12 +51,11 @@ use Omines\DataTablesBundle\Column\TextColumn;
use Omines\DataTablesBundle\DataTable;
use Omines\DataTablesBundle\DataTableTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
final class PartsDataTable implements DataTableTypeInterface
{
- public function __construct(private readonly EntityURLGenerator $urlGenerator, private readonly TranslatorInterface $translator, private readonly AmountFormatter $amountFormatter, private readonly PartDataTableHelper $partDataTableHelper, private readonly \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(private readonly EntityURLGenerator $urlGenerator, private readonly TranslatorInterface $translator, private readonly AmountFormatter $amountFormatter, private readonly PartDataTableHelper $partDataTableHelper, private readonly Security $security)
{
}
@@ -139,7 +140,7 @@ final class PartsDataTable implements DataTableTypeInterface
$tmp = [];
foreach ($context->getPartLots() as $lot) {
//Ignore lots without storelocation
- if (!$lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) {
+ if (!$lot->getStorageLocation() instanceof Storelocation) {
continue;
}
$tmp[] = sprintf(
diff --git a/src/DataTables/ProjectBomEntriesDataTable.php b/src/DataTables/ProjectBomEntriesDataTable.php
index 5c44caf1..6397ae06 100644
--- a/src/DataTables/ProjectBomEntriesDataTable.php
+++ b/src/DataTables/ProjectBomEntriesDataTable.php
@@ -53,7 +53,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
'label' => '',
'className' => 'no-colvis',
'render' => function ($value, ProjectBOMEntry $context) {
- if(!$context->getPart() instanceof \App\Entity\Parts\Part) {
+ if(!$context->getPart() instanceof Part) {
return '';
}
return $this->partDataTableHelper->renderPicture($context->getPart());
@@ -71,7 +71,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
'orderField' => 'bom_entry.quantity',
'render' => function ($value, ProjectBOMEntry $context): float|string {
//If we have a non-part entry, only show the rounded quantity
- if (!$context->getPart() instanceof \App\Entity\Parts\Part) {
+ if (!$context->getPart() instanceof Part) {
return round($context->getQuantity());
}
//Otherwise use the unit of the part to format the quantity
@@ -83,10 +83,10 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
'label' => $this->translator->trans('part.table.name'),
'orderField' => 'part.name',
'render' => function ($value, ProjectBOMEntry $context) {
- if(!$context->getPart() instanceof \App\Entity\Parts\Part) {
+ if(!$context->getPart() instanceof Part) {
return htmlspecialchars($context->getName());
}
- if($context->getPart() instanceof \App\Entity\Parts\Part) {
+ if($context->getPart() instanceof Part) {
$tmp = $this->partDataTableHelper->renderName($context->getPart());
if(!empty($context->getName())) {
$tmp .= '
'.htmlspecialchars($context->getName()).'';
@@ -100,7 +100,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
->add('description', MarkdownColumn::class, [
'label' => $this->translator->trans('part.table.description'),
'data' => function (ProjectBOMEntry $context) {
- if($context->getPart() instanceof \App\Entity\Parts\Part) {
+ if($context->getPart() instanceof Part) {
return $context->getPart()->getDescription();
}
//For non-part BOM entries show the comment field
diff --git a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php
index 4d3b9f6c..db717c3f 100644
--- a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php
+++ b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php
@@ -64,7 +64,7 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface
* @param string[] $excluded array of table/view names to be excluded from purge
*/
public function __construct(
- private ?\Doctrine\ORM\EntityManagerInterface $em = null,
+ private ?EntityManagerInterface $em = null,
/**
* Table/view names to be excluded from purge
*/
diff --git a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php
index 4b91ab57..046672d9 100644
--- a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php
+++ b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php
@@ -20,6 +20,7 @@
namespace App\Doctrine\SetSQLMode;
+use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
@@ -29,7 +30,7 @@ use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
*/
class SetSQLModeMiddlewareDriver extends AbstractDriverMiddleware
{
- public function connect(array $params): \Doctrine\DBAL\Driver\Connection
+ public function connect(array $params): Connection
{
//Only set this on MySQL connections, as other databases don't support this parameter
if($this->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
diff --git a/src/Doctrine/Types/BigDecimalType.php b/src/Doctrine/Types/BigDecimalType.php
index 4dcabbb3..83307ee8 100644
--- a/src/Doctrine/Types/BigDecimalType.php
+++ b/src/Doctrine/Types/BigDecimalType.php
@@ -53,7 +53,7 @@ class BigDecimalType extends Type
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
{
- if (!$value instanceof \Brick\Math\BigDecimal) {
+ if (!$value instanceof BigDecimal) {
return null;
}
diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php
index 5fd1de14..f2c6253e 100644
--- a/src/Entity/Attachments/Attachment.php
+++ b/src/Entity/Attachments/Attachment.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
+use App\Repository\AttachmentRepository;
+use App\EntityListeners\AttachmentDeleteListener;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractNamedDBElement;
use App\Validator\Constraints\Selectable;
use Doctrine\ORM\Mapping as ORM;
@@ -34,11 +37,11 @@ use LogicException;
/**
* Class Attachment.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\AttachmentRepository::class)]
+#[ORM\Entity(repositoryClass: AttachmentRepository::class)]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'class_name', type: 'string')]
#[ORM\DiscriminatorMap(['PartDB\Part' => 'PartAttachment', 'Part' => 'PartAttachment', 'PartDB\Device' => 'ProjectAttachment', 'Device' => 'ProjectAttachment', 'AttachmentType' => 'AttachmentTypeAttachment', 'Category' => 'CategoryAttachment', 'Footprint' => 'FootprintAttachment', 'Manufacturer' => 'ManufacturerAttachment', 'Currency' => 'CurrencyAttachment', 'Group' => 'GroupAttachment', 'MeasurementUnit' => 'MeasurementUnitAttachment', 'Storelocation' => 'StorelocationAttachment', 'Supplier' => 'SupplierAttachment', 'User' => 'UserAttachment', 'LabelProfile' => 'LabelAttachment'])]
-#[ORM\EntityListeners([\App\EntityListeners\AttachmentDeleteListener::class])]
+#[ORM\EntityListeners([AttachmentDeleteListener::class])]
#[ORM\Table(name: '`attachments`')]
#[ORM\Index(name: 'attachments_idx_id_element_id_class_name', columns: ['id', 'element_id', 'class_name'])]
#[ORM\Index(name: 'attachments_idx_class_name_id', columns: ['class_name', 'id'])]
@@ -78,13 +81,13 @@ abstract class Attachment extends AbstractNamedDBElement
/**
* @var string|null the original filename the file had, when the user uploaded it
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
+ #[ORM\Column(type: Types::STRING, nullable: true)]
protected ?string $original_filename = null;
/**
* @var string The path to the file relative to a placeholder path like %MEDIA%
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'path')]
+ #[ORM\Column(type: Types::STRING, name: 'path')]
protected string $path = '';
/**
@@ -92,7 +95,7 @@ abstract class Attachment extends AbstractNamedDBElement
*/
#[Assert\NotBlank(message: 'validator.attachment.name_not_blank')]
#[Groups(['simple', 'extended', 'full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $name = '';
/**
@@ -103,7 +106,7 @@ abstract class Attachment extends AbstractNamedDBElement
/**
* @var bool
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $show_in_table = false;
/**
diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php
index bac4ecc4..ed59a2da 100644
--- a/src/Entity/Attachments/AttachmentType.php
+++ b/src/Entity/Attachments/AttachmentType.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
+use App\Repository\StructuralDBElementRepository;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\AttachmentTypeParameter;
use App\Validator\Constraints\ValidFileFilter;
@@ -33,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class AttachmentType.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\StructuralDBElementRepository::class)]
+#[ORM\Entity(repositoryClass: StructuralDBElementRepository::class)]
#[ORM\Table(name: '`attachment_types`')]
#[ORM\Index(name: 'attachment_types_idx_name', columns: ['name'])]
#[ORM\Index(name: 'attachment_types_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -51,33 +53,36 @@ class AttachmentType extends AbstractStructuralDBElement
* @var string
* @ValidFileFilter
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $filetype_filter = '';
/**
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
/**
- * @var \Doctrine\Common\Collections\Collection<\App\Entity\Attachments\Attachment>
+ * @var Collection
+ */
+ /**
+ * @var Collection
*/
#[ORM\OneToMany(targetEntity: 'Attachment', mappedBy: 'attachment_type')]
- protected \Doctrine\Common\Collections\Collection $attachments_with_type;
+ protected Collection $attachments_with_type;
public function __construct()
{
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
parent::__construct();
$this->attachments = new ArrayCollection();
$this->attachments_with_type = new ArrayCollection();
diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php
index a8e441c2..3c81b464 100644
--- a/src/Entity/Attachments/AttachmentTypeAttachment.php
+++ b/src/Entity/Attachments/AttachmentTypeAttachment.php
@@ -36,7 +36,7 @@ class AttachmentTypeAttachment extends Attachment
/**
* @var AttachmentContainingDBElement|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php
index 854d628f..ea987b64 100644
--- a/src/Entity/Attachments/CategoryAttachment.php
+++ b/src/Entity/Attachments/CategoryAttachment.php
@@ -37,7 +37,7 @@ class CategoryAttachment extends Attachment
/**
* @var AttachmentContainingDBElement|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php
index d3b06654..419be619 100644
--- a/src/Entity/Attachments/CurrencyAttachment.php
+++ b/src/Entity/Attachments/CurrencyAttachment.php
@@ -37,7 +37,7 @@ class CurrencyAttachment extends Attachment
/**
* @var Currency|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php
index 2cd60bfb..3ac5ec8e 100644
--- a/src/Entity/Attachments/FootprintAttachment.php
+++ b/src/Entity/Attachments/FootprintAttachment.php
@@ -37,7 +37,7 @@ class FootprintAttachment extends Attachment
/**
* @var Footprint|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Footprint::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php
index e10d17f6..a6558dfa 100644
--- a/src/Entity/Attachments/GroupAttachment.php
+++ b/src/Entity/Attachments/GroupAttachment.php
@@ -38,7 +38,7 @@ class GroupAttachment extends Attachment
/**
* @var Group|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Group::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/LabelAttachment.php b/src/Entity/Attachments/LabelAttachment.php
index ddb13283..7616194c 100644
--- a/src/Entity/Attachments/LabelAttachment.php
+++ b/src/Entity/Attachments/LabelAttachment.php
@@ -57,7 +57,7 @@ class LabelAttachment extends Attachment
/**
* @var LabelProfile the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\LabelSystem\LabelProfile::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: LabelProfile::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php
index 620d5c58..65ac461c 100644
--- a/src/Entity/Attachments/ManufacturerAttachment.php
+++ b/src/Entity/Attachments/ManufacturerAttachment.php
@@ -38,7 +38,7 @@ class ManufacturerAttachment extends Attachment
/**
* @var Manufacturer|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Manufacturer::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php
index 0df01536..d79b40a7 100644
--- a/src/Entity/Attachments/MeasurementUnitAttachment.php
+++ b/src/Entity/Attachments/MeasurementUnitAttachment.php
@@ -38,7 +38,7 @@ class MeasurementUnitAttachment extends Attachment
/**
* @var Manufacturer|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php
index fbc7479c..54f12180 100644
--- a/src/Entity/Attachments/PartAttachment.php
+++ b/src/Entity/Attachments/PartAttachment.php
@@ -37,7 +37,7 @@ class PartAttachment extends Attachment
/**
* @var Part the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/ProjectAttachment.php b/src/Entity/Attachments/ProjectAttachment.php
index 6dfa9dcd..76c77bc2 100644
--- a/src/Entity/Attachments/ProjectAttachment.php
+++ b/src/Entity/Attachments/ProjectAttachment.php
@@ -37,7 +37,7 @@ class ProjectAttachment extends Attachment
/**
* @var Project|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php
index f1ac9090..3831630c 100644
--- a/src/Entity/Attachments/StorelocationAttachment.php
+++ b/src/Entity/Attachments/StorelocationAttachment.php
@@ -38,7 +38,7 @@ class StorelocationAttachment extends Attachment
/**
* @var Storelocation|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php
index 241f401a..deba7480 100644
--- a/src/Entity/Attachments/SupplierAttachment.php
+++ b/src/Entity/Attachments/SupplierAttachment.php
@@ -38,7 +38,7 @@ class SupplierAttachment extends Attachment
/**
* @var Supplier|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php
index c08b38f8..8d8c2e04 100644
--- a/src/Entity/Attachments/UserAttachment.php
+++ b/src/Entity/Attachments/UserAttachment.php
@@ -38,7 +38,7 @@ class UserAttachment extends Attachment
/**
* @var User|null the element this attachment is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'attachments')]
+ #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}
diff --git a/src/Entity/Base/AbstractCompany.php b/src/Entity/Base/AbstractCompany.php
index f265349a..4d0678c4 100644
--- a/src/Entity/Base/AbstractCompany.php
+++ b/src/Entity/Base/AbstractCompany.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Base;
+use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use function is_string;
@@ -37,21 +38,21 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
* @var string The address of the company
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $address = '';
/**
* @var string The phone number of the company
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $phone_number = '';
/**
* @var string The fax number of the company
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $fax_number = '';
/**
@@ -59,7 +60,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
*/
#[Assert\Email]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $email_address = '';
/**
@@ -67,13 +68,13 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
*/
#[Assert\Url]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $website = '';
/**
* @var string
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $auto_product_url = '';
/********************************************************************************
diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php
index 101493fe..30fcab06 100644
--- a/src/Entity/Base/AbstractDBElement.php
+++ b/src/Entity/Base/AbstractDBElement.php
@@ -22,6 +22,37 @@ declare(strict_types=1);
namespace App\Entity\Base;
+use App\Entity\Attachments\AttachmentType;
+use App\Entity\Attachments\Attachment;
+use App\Entity\Attachments\AttachmentTypeAttachment;
+use App\Entity\Attachments\CategoryAttachment;
+use App\Entity\Attachments\CurrencyAttachment;
+use App\Entity\Attachments\FootprintAttachment;
+use App\Entity\Attachments\GroupAttachment;
+use App\Entity\Attachments\LabelAttachment;
+use App\Entity\Attachments\ManufacturerAttachment;
+use App\Entity\Attachments\MeasurementUnitAttachment;
+use App\Entity\Attachments\PartAttachment;
+use App\Entity\Attachments\ProjectAttachment;
+use App\Entity\Attachments\StorelocationAttachment;
+use App\Entity\Attachments\SupplierAttachment;
+use App\Entity\Attachments\UserAttachment;
+use App\Entity\Parts\Category;
+use App\Entity\ProjectSystem\Project;
+use App\Entity\ProjectSystem\ProjectBOMEntry;
+use App\Entity\Parts\Footprint;
+use App\Entity\UserSystem\Group;
+use App\Entity\Parts\Manufacturer;
+use App\Entity\PriceInformations\Orderdetail;
+use App\Entity\Parts\Part;
+use App\Entity\Parts\Storelocation;
+use App\Entity\Parts\PartLot;
+use App\Entity\PriceInformations\Currency;
+use App\Entity\Parts\MeasurementUnit;
+use App\Entity\Parts\Supplier;
+use App\Entity\UserSystem\User;
+use App\Repository\DBElementRepository;
+use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
@@ -35,15 +66,15 @@ use Symfony\Component\Serializer\Annotation\Groups;
* Every database table which are managed with this class (or a subclass of it)
* must have the table row "id"!! The ID is the unique key to identify the elements.
*/
-#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => \App\Entity\Attachments\AttachmentType::class, 'attachment' => \App\Entity\Attachments\Attachment::class, 'attachment_type_attachment' => \App\Entity\Attachments\AttachmentTypeAttachment::class, 'category_attachment' => \App\Entity\Attachments\CategoryAttachment::class, 'currency_attachment' => \App\Entity\Attachments\CurrencyAttachment::class, 'footprint_attachment' => \App\Entity\Attachments\FootprintAttachment::class, 'group_attachment' => \App\Entity\Attachments\GroupAttachment::class, 'label_attachment' => \App\Entity\Attachments\LabelAttachment::class, 'manufacturer_attachment' => \App\Entity\Attachments\ManufacturerAttachment::class, 'measurement_unit_attachment' => \App\Entity\Attachments\MeasurementUnitAttachment::class, 'part_attachment' => \App\Entity\Attachments\PartAttachment::class, 'project_attachment' => \App\Entity\Attachments\ProjectAttachment::class, 'storelocation_attachment' => \App\Entity\Attachments\StorelocationAttachment::class, 'supplier_attachment' => \App\Entity\Attachments\SupplierAttachment::class, 'user_attachment' => \App\Entity\Attachments\UserAttachment::class, 'category' => \App\Entity\Parts\Category::class, 'project' => \App\Entity\ProjectSystem\Project::class, 'project_bom_entry' => \App\Entity\ProjectSystem\ProjectBOMEntry::class, 'footprint' => \App\Entity\Parts\Footprint::class, 'group' => \App\Entity\UserSystem\Group::class, 'manufacturer' => \App\Entity\Parts\Manufacturer::class, 'orderdetail' => \App\Entity\PriceInformations\Orderdetail::class, 'part' => \App\Entity\Parts\Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => \App\Entity\Parts\Storelocation::class, 'part_lot' => \App\Entity\Parts\PartLot::class, 'currency' => \App\Entity\PriceInformations\Currency::class, 'measurement_unit' => \App\Entity\Parts\MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => \App\Entity\Parts\Supplier::class, 'user' => \App\Entity\UserSystem\User::class])]
-#[ORM\MappedSuperclass(repositoryClass: \App\Repository\DBElementRepository::class)]
+#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorelocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => Storelocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => Supplier::class, 'user' => User::class])]
+#[ORM\MappedSuperclass(repositoryClass: DBElementRepository::class)]
abstract class AbstractDBElement implements JsonSerializable
{
/** @var int|null The Identification number for this part. This value is unique for the element in this table.
* Null if the element is not saved to DB yet.
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $id = null;
diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php
index f286e6b8..20009658 100644
--- a/src/Entity/Base/AbstractNamedDBElement.php
+++ b/src/Entity/Base/AbstractNamedDBElement.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Base;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Contracts\NamedElementInterface;
use App\Entity\Contracts\TimeStampableInterface;
use Doctrine\ORM\Mapping as ORM;
@@ -42,7 +43,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
*/
#[Assert\NotBlank]
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $name = '';
/******************************************************************************
diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php
index 1885bfb9..211340bc 100644
--- a/src/Entity/Base/AbstractPartsContainingDBElement.php
+++ b/src/Entity/Base/AbstractPartsContainingDBElement.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Base;
+use App\Repository\AbstractPartsContainingRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
@@ -29,7 +30,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
/**
* Class PartsContainingDBElement.
*/
-#[ORM\MappedSuperclass(repositoryClass: \App\Repository\AbstractPartsContainingRepository::class)]
+#[ORM\MappedSuperclass(repositoryClass: AbstractPartsContainingRepository::class)]
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{
#[Groups(['full'])]
diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php
index 847c5ff3..a1dc80dd 100644
--- a/src/Entity/Base/AbstractStructuralDBElement.php
+++ b/src/Entity/Base/AbstractStructuralDBElement.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Base;
+use App\Repository\StructuralDBElementRepository;
+use App\EntityListeners\TreeCacheInvalidationListener;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Parameters\ParametersTrait;
use App\Validator\Constraints\NoneOfItsChildren;
@@ -46,24 +49,24 @@ use Symfony\Component\Serializer\Annotation\Groups;
*
*/
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
-#[ORM\MappedSuperclass(repositoryClass: \App\Repository\StructuralDBElementRepository::class)]
-#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])]
+#[ORM\MappedSuperclass(repositoryClass: StructuralDBElementRepository::class)]
+#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
{
use ParametersTrait;
- public const ID_ROOT_ELEMENT = 0;
+ final public const ID_ROOT_ELEMENT = 0;
/**
* This is a not standard character, so build a const, so a dev can easily use it.
*/
- public const PATH_DELIMITER_ARROW = ' → ';
+ final public const PATH_DELIMITER_ARROW = ' → ';
/**
* @var string The comment info for this element
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $comment = '';
/**
@@ -71,7 +74,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
* Useful if this element should be used only for grouping, sorting.
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $not_selectable = false;
/**
diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php
index e3801fb6..21168282 100644
--- a/src/Entity/Base/MasterAttachmentTrait.php
+++ b/src/Entity/Base/MasterAttachmentTrait.php
@@ -35,7 +35,7 @@ trait MasterAttachmentTrait
* @var Attachment|null
*/
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
- #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)]
+ #[ORM\ManyToOne(targetEntity: Attachment::class)]
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
protected ?Attachment $master_picture_attachment = null;
diff --git a/src/Entity/Base/TimestampTrait.php b/src/Entity/Base/TimestampTrait.php
index 9091fe70..93e58cb7 100644
--- a/src/Entity/Base/TimestampTrait.php
+++ b/src/Entity/Base/TimestampTrait.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Base;
+use Doctrine\DBAL\Types\Types;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
@@ -35,14 +36,14 @@ trait TimestampTrait
* @var \DateTimeInterface|null the date when this element was modified the last time
*/
#[Groups(['extended', 'full'])]
- #[ORM\Column(name: 'last_modified', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
+ #[ORM\Column(name: 'last_modified', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
protected ?\DateTimeInterface $lastModified = null;
/**
* @var \DateTimeInterface|null the date when this element was created
*/
#[Groups(['extended', 'full'])]
- #[ORM\Column(name: 'datetime_added', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
+ #[ORM\Column(name: 'datetime_added', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
protected ?\DateTimeInterface $addedDate = null;
/**
diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php
index b50230e8..1ee86079 100644
--- a/src/Entity/LabelSystem/LabelOptions.php
+++ b/src/Entity/LabelSystem/LabelOptions.php
@@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\Entity\LabelSystem;
+use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
@@ -57,53 +58,53 @@ class LabelOptions
* @var float The page size of the label in mm
*/
#[Assert\Positive]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
+ #[ORM\Column(type: Types::FLOAT)]
protected float $width = 50.0;
/**
* @var float The page size of the label in mm
*/
#[Assert\Positive]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
+ #[ORM\Column(type: Types::FLOAT)]
protected float $height = 30.0;
/**
* @var string The type of the barcode that should be used in the label (e.g. 'qr')
*/
#[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $barcode_type = 'none';
/**
* @var string What image should be shown along the
*/
#[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $picture_type = 'none';
/**
* @var string
*/
#[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $supported_element = 'part';
/**
* @var string any additional CSS for the label
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $additional_css = '';
/** @var string The mode that will be used to interpret the lines
*/
#[Assert\Choice(choices: LabelOptions::LINES_MODES)]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $lines_mode = 'html';
/**
* @var string
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $lines = '';
public function getWidth(): float
diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php
index c7fd4a26..9b13e165 100644
--- a/src/Entity/LabelSystem/LabelProfile.php
+++ b/src/Entity/LabelSystem/LabelProfile.php
@@ -41,6 +41,10 @@ declare(strict_types=1);
namespace App\Entity\LabelSystem;
+use App\Repository\LabelProfileRepository;
+use App\EntityListeners\TreeCacheInvalidationListener;
+use Doctrine\DBAL\Types\Types;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\LabelAttachment;
use Doctrine\Common\Collections\Collection;
@@ -49,15 +53,15 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
#[UniqueEntity(['name', 'options.supported_element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\LabelProfileRepository::class)]
-#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])]
+#[ORM\Entity(repositoryClass: LabelProfileRepository::class)]
+#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
#[ORM\Table(name: 'label_profiles')]
class LabelProfile extends AttachmentContainingDBElement
{
/**
* @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
@@ -71,18 +75,18 @@ class LabelProfile extends AttachmentContainingDBElement
/**
* @var string The comment info for this element
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $comment = '';
/**
* @var bool determines, if this label profile should be shown in the dropdown quick menu
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $show_in_dropdown = true;
public function __construct()
{
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->attachments = new ArrayCollection();
parent::__construct();
$this->options = new LabelOptions();
}
diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php
index fe94ec81..7cc064b7 100644
--- a/src/Entity/LogSystem/AbstractLogEntry.php
+++ b/src/Entity/LogSystem/AbstractLogEntry.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\LogSystem;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractDBElement;
@@ -129,19 +130,19 @@ abstract class AbstractLogEntry extends AbstractDBElement
/** @var User|null The user which has caused this log entry
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, fetch: 'EAGER')]
+ #[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')]
#[ORM\JoinColumn(name: 'id_user', onDelete: 'SET NULL')]
protected ?User $user = null;
/**
* @var string The username of the user which has caused this log entry (shown if the user is deleted)
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $username = '';
/** @var \DateTimeInterface|null The datetime the event associated with this log entry has occured
*/
- #[ORM\Column(name: 'datetime', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
+ #[ORM\Column(name: 'datetime', type: Types::DATETIME_MUTABLE)]
protected ?\DateTimeInterface $timestamp = null;
/** @var int The priority level of the associated level. 0 is highest, 7 lowest
@@ -151,12 +152,12 @@ abstract class AbstractLogEntry extends AbstractDBElement
/** @var int The ID of the element targeted by this event
*/
- #[ORM\Column(name: 'target_id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(name: 'target_id', type: Types::INTEGER)]
protected int $target_id = 0;
/** @var int The Type of the targeted element
*/
- #[ORM\Column(name: 'target_type', type: \Doctrine\DBAL\Types\Types::SMALLINT)]
+ #[ORM\Column(name: 'target_type', type: Types::SMALLINT)]
protected int $target_type = 0;
/** @var string The type of this log entry, aka the description what has happened.
@@ -167,7 +168,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
/** @var array The extra data in raw (short form) saved in the DB
*/
- #[ORM\Column(name: 'extra', type: \Doctrine\DBAL\Types\Types::JSON)]
+ #[ORM\Column(name: 'extra', type: Types::JSON)]
protected array $extra = [];
public function __construct()
@@ -370,7 +371,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
*/
public function setTargetElement(?AbstractDBElement $element): self
{
- if (!$element instanceof \App\Entity\Base\AbstractDBElement) {
+ if (!$element instanceof AbstractDBElement) {
$this->target_id = 0;
$this->target_type = self::TARGET_TYPE_NONE;
diff --git a/src/Entity/LogSystem/PartStockChangedLogEntry.php b/src/Entity/LogSystem/PartStockChangedLogEntry.php
index 22c7a9ee..5ac1c953 100644
--- a/src/Entity/LogSystem/PartStockChangedLogEntry.php
+++ b/src/Entity/LogSystem/PartStockChangedLogEntry.php
@@ -68,7 +68,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry
$this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...');
}
- if ($move_to_target instanceof \App\Entity\Parts\PartLot) {
+ if ($move_to_target instanceof PartLot) {
if ($type !== self::TYPE_MOVE) {
throw new \InvalidArgumentException('The move_to_target parameter can only be set if the type is "move"!');
}
diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php
index dd080d5a..6e4a77f3 100644
--- a/src/Entity/Parameters/AbstractParameter.php
+++ b/src/Entity/Parameters/AbstractParameter.php
@@ -41,6 +41,8 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use Doctrine\ORM\Mapping as ORM;
@@ -51,7 +53,7 @@ use Symfony\Component\Validator\Constraints as Assert;
use function sprintf;
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')]
#[ORM\DiscriminatorMap([0 => 'CategoryParameter', 1 => 'CurrencyParameter', 2 => 'ProjectParameter', 3 => 'FootprintParameter', 4 => 'GroupParameter', 5 => 'ManufacturerParameter', 6 => 'MeasurementUnitParameter', 7 => 'PartParameter', 8 => 'StorelocationParameter', 9 => 'SupplierParameter', 10 => 'AttachmentTypeParameter'])]
@@ -71,7 +73,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
*/
#[Assert\Length(max: 20)]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $symbol = '';
/**
@@ -81,7 +83,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
#[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')]
#[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
+ #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_min = null;
/**
@@ -89,7 +91,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
*/
#[Assert\Type([null, 'float'])]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
+ #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_typical = null;
/**
@@ -98,21 +100,21 @@ abstract class AbstractParameter extends AbstractNamedDBElement
#[Assert\Type(['float', null])]
#[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
+ #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_max = null;
/**
* @var string The unit in which the value values are given (e.g. V)
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $unit = '';
/**
* @var string a text value for the given property
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $value_text = '';
/**
@@ -120,7 +122,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
*/
#[Groups(['full'])]
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'param_group')]
+ #[ORM\Column(type: Types::STRING, name: 'param_group')]
protected string $group = '';
/**
diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php
index f06c26aa..2ac9dc09 100644
--- a/src/Entity/Parameters/AttachmentTypeParameter.php
+++ b/src/Entity/Parameters/AttachmentTypeParameter.php
@@ -41,20 +41,21 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class AttachmentTypeParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
/**
* @var AttachmentType the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php
index 94004355..8aa4f29c 100644
--- a/src/Entity/Parameters/CategoryParameter.php
+++ b/src/Entity/Parameters/CategoryParameter.php
@@ -41,20 +41,21 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Category;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class CategoryParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Category::class;
/**
* @var Category the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php
index 3db70701..3540f5cb 100644
--- a/src/Entity/Parameters/CurrencyParameter.php
+++ b/src/Entity/Parameters/CurrencyParameter.php
@@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\PriceInformations\Currency;
use Doctrine\ORM\Mapping as ORM;
@@ -50,7 +51,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a category element.
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class CurrencyParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Currency::class;
@@ -58,7 +59,7 @@ class CurrencyParameter extends AbstractParameter
/**
* @var Currency the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php
index ca632a8f..2a978b04 100644
--- a/src/Entity/Parameters/FootprintParameter.php
+++ b/src/Entity/Parameters/FootprintParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Footprint;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class FootprintParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Footprint::class;
@@ -55,7 +56,7 @@ class FootprintParameter extends AbstractParameter
/**
* @var Footprint the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Footprint::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php
index eb838e99..1bc23ea8 100644
--- a/src/Entity/Parameters/GroupParameter.php
+++ b/src/Entity/Parameters/GroupParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\UserSystem\Group;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class GroupParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Group::class;
@@ -55,7 +56,7 @@ class GroupParameter extends AbstractParameter
/**
* @var Group the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Group::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php
index d4a59793..6f33dce8 100644
--- a/src/Entity/Parameters/ManufacturerParameter.php
+++ b/src/Entity/Parameters/ManufacturerParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Manufacturer;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class ManufacturerParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
@@ -55,7 +56,7 @@ class ManufacturerParameter extends AbstractParameter
/**
* @var Manufacturer the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Manufacturer::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php
index a32910be..7332474e 100644
--- a/src/Entity/Parameters/MeasurementUnitParameter.php
+++ b/src/Entity/Parameters/MeasurementUnitParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\MeasurementUnit;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class MeasurementUnitParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
@@ -55,7 +56,7 @@ class MeasurementUnitParameter extends AbstractParameter
/**
* @var MeasurementUnit the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php
index 65aba267..36fc71fb 100644
--- a/src/Entity/Parameters/PartParameter.php
+++ b/src/Entity/Parameters/PartParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class PartParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Part::class;
@@ -55,7 +56,7 @@ class PartParameter extends AbstractParameter
/**
* @var Part the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php
index 11462e38..7413ca8a 100644
--- a/src/Entity/Parameters/ProjectParameter.php
+++ b/src/Entity/Parameters/ProjectParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\ProjectSystem\Project;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class ProjectParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Project::class;
@@ -55,7 +56,7 @@ class ProjectParameter extends AbstractParameter
/**
* @var Project the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php
index f6ed82e2..098d3a5e 100644
--- a/src/Entity/Parameters/StorelocationParameter.php
+++ b/src/Entity/Parameters/StorelocationParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Storelocation;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class StorelocationParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
@@ -55,7 +56,7 @@ class StorelocationParameter extends AbstractParameter
/**
* @var Storelocation the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php
index 6ffcbcfa..5c87ac08 100644
--- a/src/Entity/Parameters/SupplierParameter.php
+++ b/src/Entity/Parameters/SupplierParameter.php
@@ -41,13 +41,14 @@ declare(strict_types=1);
namespace App\Entity\Parameters;
+use App\Repository\ParameterRepository;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parts\Supplier;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity(fields: ['name', 'group', 'element'])]
-#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
+#[ORM\Entity(repositoryClass: ParameterRepository::class)]
class SupplierParameter extends AbstractParameter
{
final public const ALLOWED_ELEMENT_CLASS = Supplier::class;
@@ -55,7 +56,7 @@ class SupplierParameter extends AbstractParameter
/**
* @var Supplier the element this para is associated with
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'parameters')]
+ #[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}
diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php
index ba5c5750..7ac0b209 100644
--- a/src/Entity/Parts/Category.php
+++ b/src/Entity/Parts/Category.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\Parts\CategoryRepository;
+use Doctrine\DBAL\Types\Types;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\CategoryAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
@@ -34,7 +37,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class AttachmentType.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\CategoryRepository::class)]
+#[ORM\Entity(repositoryClass: CategoryRepository::class)]
#[ORM\Table(name: '`categories`')]
#[ORM\Index(name: 'category_idx_name', columns: ['name'])]
#[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -55,56 +58,56 @@ class Category extends AbstractPartsContainingDBElement
* @var string
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $partname_hint = '';
/**
* @var string
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $partname_regex = '';
/**
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $disable_footprints = false;
/**
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $disable_manufacturers = false;
/**
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $disable_autodatasheets = false;
/**
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $disable_properties = false;
/**
* @var string
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $default_description = '';
/**
* @var string
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $default_comment = '';
/**
@@ -112,7 +115,7 @@ class Category extends AbstractPartsContainingDBElement
*/
#[Assert\Valid]
#[Groups(['full'])]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
@@ -120,7 +123,7 @@ class Category extends AbstractPartsContainingDBElement
*/
#[Assert\Valid]
#[Groups(['full'])]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -222,8 +225,8 @@ class Category extends AbstractPartsContainingDBElement
public function __construct()
{
parent::__construct();
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
}
}
diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php
index b228141f..13edd726 100644
--- a/src/Entity/Parts/Footprint.php
+++ b/src/Entity/Parts/Footprint.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\Parts\FootprintRepository;
+use App\Entity\Base\AbstractStructuralDBElement;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\FootprintAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Parameters\FootprintParameter;
@@ -32,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Footprint.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\FootprintRepository::class)]
+#[ORM\Entity(repositoryClass: FootprintRepository::class)]
#[ORM\Table('`footprints`')]
#[ORM\Index(name: 'footprint_idx_name', columns: ['name'])]
#[ORM\Index(name: 'footprint_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -40,7 +43,7 @@ class Footprint extends AbstractPartsContainingDBElement
{
#[ORM\ManyToOne(targetEntity: 'Footprint', inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
- protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null;
+ protected ?AbstractStructuralDBElement $parent = null;
/**
* @var Collection
@@ -53,21 +56,21 @@ class Footprint extends AbstractPartsContainingDBElement
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/**
* @var FootprintAttachment|null
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\FootprintAttachment::class)]
+ #[ORM\ManyToOne(targetEntity: FootprintAttachment::class)]
#[ORM\JoinColumn(name: 'id_footprint_3d')]
protected ?FootprintAttachment $footprint_3d = null;
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -102,8 +105,8 @@ class Footprint extends AbstractPartsContainingDBElement
public function __construct()
{
parent::__construct();
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
}
}
diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php
index 0ff9d49c..ee595c38 100644
--- a/src/Entity/Parts/Manufacturer.php
+++ b/src/Entity/Parts/Manufacturer.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\Parts\ManufacturerRepository;
+use App\Entity\Base\AbstractStructuralDBElement;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\ManufacturerAttachment;
use App\Entity\Base\AbstractCompany;
use App\Entity\Parameters\ManufacturerParameter;
@@ -32,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Manufacturer.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\ManufacturerRepository::class)]
+#[ORM\Entity(repositoryClass: ManufacturerRepository::class)]
#[ORM\Table('`manufacturers`')]
#[ORM\Index(name: 'manufacturer_name', columns: ['name'])]
#[ORM\Index(name: 'manufacturer_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -40,7 +43,7 @@ class Manufacturer extends AbstractCompany
{
#[ORM\ManyToOne(targetEntity: 'Manufacturer', inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
- protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null;
+ protected ?AbstractStructuralDBElement $parent = null;
/**
* @var Collection
@@ -53,21 +56,21 @@ class Manufacturer extends AbstractCompany
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
public function __construct()
{
parent::__construct();
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
}
}
diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php
index 1faac9e0..10259ace 100644
--- a/src/Entity/Parts/MeasurementUnit.php
+++ b/src/Entity/Parts/MeasurementUnit.php
@@ -22,6 +22,10 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\Parts\MeasurementUnitRepository;
+use Doctrine\DBAL\Types\Types;
+use App\Entity\Base\AbstractStructuralDBElement;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\MeasurementUnitAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Parameters\MeasurementUnitParameter;
@@ -36,7 +40,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* This could be something like N, grams, meters, etc...
*/
#[UniqueEntity('unit')]
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\MeasurementUnitRepository::class)]
+#[ORM\Entity(repositoryClass: MeasurementUnitRepository::class)]
#[ORM\Table(name: '`measurement_units`')]
#[ORM\Index(name: 'unit_idx_name', columns: ['name'])]
#[ORM\Index(name: 'unit_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -48,7 +52,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
*/
#[Assert\Length(max: 10)]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'unit', nullable: true)]
+ #[ORM\Column(type: Types::STRING, name: 'unit', nullable: true)]
protected ?string $unit = null;
/**
@@ -56,7 +60,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* Set to false, to measure continuous sizes likes masses or lengths.
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'is_integer')]
+ #[ORM\Column(type: Types::BOOLEAN, name: 'is_integer')]
protected bool $is_integer = false;
/**
@@ -65,7 +69,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
*/
#[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')]
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'use_si_prefix')]
+ #[ORM\Column(type: Types::BOOLEAN, name: 'use_si_prefix')]
protected bool $use_si_prefix = false;
/**
@@ -77,20 +81,20 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit', inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
- protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null;
+ protected ?AbstractStructuralDBElement $parent = null;
/**
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -135,8 +139,8 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
public function __construct()
{
parent::__construct();
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
}
}
diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php
index a77f10e5..b8ff5abb 100644
--- a/src/Entity/Parts/Part.php
+++ b/src/Entity/Parts/Part.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\PartRepository;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\PartAttachment;
@@ -49,7 +51,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* Otherwise, this class would be too big, to be maintained.
*/
#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')]
-#[ORM\Entity(repositoryClass: \App\Repository\PartRepository::class)]
+#[ORM\Entity(repositoryClass: PartRepository::class)]
#[ORM\Table('`parts`')]
#[ORM\Index(name: 'parts_idx_datet_name_last_id_needs', columns: ['datetime_added', 'name', 'last_modified', 'id', 'needs_review'])]
#[ORM\Index(name: 'parts_idx_name', columns: ['name'])]
@@ -69,7 +71,7 @@ class Part extends AttachmentContainingDBElement
*/
#[Assert\Valid]
#[Groups(['full'])]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -81,7 +83,7 @@ class Part extends AttachmentContainingDBElement
/**
* @var string The name of this part
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $name = '';
/**
@@ -89,7 +91,7 @@ class Part extends AttachmentContainingDBElement
*/
#[Assert\Valid]
#[Groups(['full'])]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
@@ -97,13 +99,13 @@ class Part extends AttachmentContainingDBElement
* @var Attachment|null
*/
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
- #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)]
+ #[ORM\ManyToOne(targetEntity: Attachment::class)]
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
protected ?Attachment $master_picture_attachment = null;
public function __construct()
{
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->attachments = new ArrayCollection();
parent::__construct();
$this->partLots = new ArrayCollection();
$this->orderdetails = new ArrayCollection();
@@ -142,7 +144,7 @@ class Part extends AttachmentContainingDBElement
public function validate(ExecutionContextInterface $context, $payload)
{
//Ensure that the part name fullfills the regex of the category
- if ($this->category instanceof \App\Entity\Parts\Category) {
+ if ($this->category instanceof Category) {
$regex = $this->category->getPartnameRegex();
if (!empty($regex) && !preg_match($regex, $this->name)) {
$context->buildViolation('part.name.must_match_category_regex')
diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php
index 58b30726..7bec9b9c 100644
--- a/src/Entity/Parts/PartLot.php
+++ b/src/Entity/Parts/PartLot.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
use App\Entity\Contracts\NamedElementInterface;
@@ -55,14 +56,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var string A short description about this lot, shown in table
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $description = '';
/**
* @var string a comment stored with this lot
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $comment = '';
/**
@@ -70,7 +71,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* Set to null, if the lot can be used indefinitely.
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)]
+ #[ORM\Column(type: Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)]
protected ?\DateTimeInterface $expiration_date = null;
/**
@@ -86,7 +87,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var bool If this is set to true, the instock amount is marked as not known
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $instock_unknown = false;
/**
@@ -94,14 +95,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
*/
#[Assert\PositiveOrZero]
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
+ #[ORM\Column(type: Types::FLOAT)]
protected float $amount = 0.0;
/**
* @var bool determines if this lot was manually marked for refilling
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $needs_refill = false;
/**
@@ -115,7 +116,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* @var User|null The owner of this part lot
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)]
+ #[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')]
protected ?User $owner = null;
diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php
index 9079c21d..633bf9d0 100644
--- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php
+++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Parts\PartTraits;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
@@ -36,14 +37,14 @@ trait AdvancedPropertyTrait
* @var bool Determines if this part entry needs review (for example, because it is work in progress)
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $needs_review = false;
/**
* @var string a comma separated list of tags, associated with the part
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $tags = '';
/**
@@ -51,7 +52,7 @@ trait AdvancedPropertyTrait
*/
#[Assert\PositiveOrZero]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
+ #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $mass = null;
/**
@@ -59,7 +60,7 @@ trait AdvancedPropertyTrait
*/
#[Assert\Length(max: 100)]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100, nullable: true, unique: true)]
+ #[ORM\Column(type: Types::STRING, length: 100, nullable: true, unique: true)]
protected ?string $ipn = null;
/**
diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php
index 4d90a307..aa08f514 100644
--- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php
+++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Parts\PartTraits;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Validator\Constraints\Selectable;
@@ -35,27 +36,27 @@ trait BasicPropertyTrait
* @var string A text describing what this part does
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $description = '';
/**
* @var string A comment/note related to this part
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $comment = '';
/**
* @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions)
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $visible = true;
/**
* @var bool true, if the part is marked as favorite
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $favorite = false;
/**
diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php
index 9ae170ab..f4a95e16 100644
--- a/src/Entity/Parts/PartTraits/InstockTrait.php
+++ b/src/Entity/Parts/PartTraits/InstockTrait.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Parts\PartTraits;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\PartLot;
use Doctrine\Common\Collections\Collection;
@@ -41,7 +42,7 @@ trait InstockTrait
#[Groups(['extended', 'full', 'import'])]
#[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['amount' => 'DESC'])]
- protected \Doctrine\Common\Collections\Collection $partLots;
+ protected Collection $partLots;
/**
* @var float The minimum amount of the part that has to be instock, otherwise more is ordered.
@@ -49,7 +50,7 @@ trait InstockTrait
*/
#[Assert\PositiveOrZero]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
+ #[ORM\Column(type: Types::FLOAT)]
protected float $minamount = 0;
/**
diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php
index d79a9128..0a66dfa0 100644
--- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php
+++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Parts\PartTraits;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Part;
use App\Validator\Constraints\Selectable;
@@ -48,14 +49,14 @@ trait ManufacturerTrait
*/
#[Assert\Url]
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $manufacturer_product_url = '';
/**
* @var string The product number used by the manufacturer. If this is set to "", the name field is used.
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $manufacturer_product_number = '';
/**
@@ -63,7 +64,7 @@ trait ManufacturerTrait
*/
#[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
+ #[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
protected ?string $manufacturing_status = '';
/**
diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php
index 18b6698e..b17f014b 100644
--- a/src/Entity/Parts/PartTraits/OrderTrait.php
+++ b/src/Entity/Parts/PartTraits/OrderTrait.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Parts\PartTraits;
+use Doctrine\DBAL\Types\Types;
use App\Entity\PriceInformations\Orderdetail;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
@@ -39,26 +40,26 @@ trait OrderTrait
*/
#[Assert\Valid]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['supplierpartnr' => 'ASC'])]
- protected \Doctrine\Common\Collections\Collection $orderdetails;
+ protected Collection $orderdetails;
/**
* @var int
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
protected int $order_quantity = 0;
/**
* @var bool
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $manual_order = false;
/**
* @var Orderdetail|null
*/
- #[ORM\OneToOne(targetEntity: \App\Entity\PriceInformations\Orderdetail::class)]
+ #[ORM\OneToOne(targetEntity: Orderdetail::class)]
#[ORM\JoinColumn(name: 'order_orderdetails_id')]
protected ?Orderdetail $order_orderdetail = null;
diff --git a/src/Entity/Parts/PartTraits/ProjectTrait.php b/src/Entity/Parts/PartTraits/ProjectTrait.php
index 2a5cf6ed..5d627a70 100644
--- a/src/Entity/Parts/PartTraits/ProjectTrait.php
+++ b/src/Entity/Parts/PartTraits/ProjectTrait.php
@@ -11,15 +11,18 @@ use Doctrine\ORM\Mapping as ORM;
trait ProjectTrait
{
/**
- * @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries
+ * @var Collection $project_bom_entries
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\ProjectSystem\ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
- protected \Doctrine\Common\Collections\Collection $project_bom_entries;
+ /**
+ * @var Collection $project_bom_entries
+ */
+ #[ORM\OneToMany(targetEntity: ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
+ protected Collection $project_bom_entries;
/**
* @var Project|null If a project is set here, then this part is special and represents the builds of a project.
*/
- #[ORM\OneToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'build_part')]
+ #[ORM\OneToOne(targetEntity: Project::class, inversedBy: 'build_part')]
#[ORM\JoinColumn]
protected ?Project $built_project = null;
diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php
index 71ea2669..15eef200 100644
--- a/src/Entity/Parts/Storelocation.php
+++ b/src/Entity/Parts/Storelocation.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\Parts\StorelocationRepository;
+use Doctrine\DBAL\Types\Types;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
@@ -35,7 +38,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Store location.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\StorelocationRepository::class)]
+#[ORM\Entity(repositoryClass: StorelocationRepository::class)]
#[ORM\Table('`storelocations`')]
#[ORM\Index(name: 'location_idx_name', columns: ['name'])]
#[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -62,7 +65,7 @@ class Storelocation extends AbstractPartsContainingDBElement
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -70,42 +73,42 @@ class Storelocation extends AbstractPartsContainingDBElement
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $is_full = false;
/**
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $only_single_part = false;
/**
* @var bool
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $limit_to_existing_parts = false;
/**
* @var User|null The owner of this storage location
*/
#[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')]
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)]
+ #[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')]
protected ?User $owner = null;
/**
* @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here.
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
+ #[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
protected bool $part_owner_must_match = false;
/**
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
protected Collection $attachments;
/********************************************************************************
@@ -229,8 +232,8 @@ class Storelocation extends AbstractPartsContainingDBElement
public function __construct()
{
parent::__construct();
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
}
}
diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php
index d0d4bd12..2746f131 100644
--- a/src/Entity/Parts/Supplier.php
+++ b/src/Entity/Parts/Supplier.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\Parts;
+use App\Repository\Parts\SupplierRepository;
+use App\Entity\PriceInformations\Orderdetail;
+use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Base\AbstractCompany;
use App\Entity\Base\AbstractStructuralDBElement;
@@ -38,7 +41,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Supplier.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\SupplierRepository::class)]
+#[ORM\Entity(repositoryClass: SupplierRepository::class)]
#[ORM\Table('`suppliers`')]
#[ORM\Index(name: 'supplier_idx_name', columns: ['name'])]
#[ORM\Index(name: 'supplier_idx_parent_name', columns: ['parent_id', 'name'])]
@@ -56,9 +59,12 @@ class Supplier extends AbstractCompany
protected ?AbstractStructuralDBElement $parent = null;
/**
- * @var \Doctrine\Common\Collections\Collection|\App\Entity\PriceInformations\Orderdetail[]
+ * @var Collection|Orderdetail[]
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'supplier')]
+ /**
+ * @var Collection|Orderdetail[]
+ */
+ #[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'supplier')]
protected Collection $orderdetails;
/**
@@ -66,7 +72,7 @@ class Supplier extends AbstractCompany
* Set to null, to use global base currency.
* @Selectable()
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)]
+ #[ORM\ManyToOne(targetEntity: Currency::class)]
#[ORM\JoinColumn(name: 'default_currency_id')]
protected ?Currency $default_currency = null;
@@ -82,14 +88,14 @@ class Supplier extends AbstractCompany
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -128,7 +134,7 @@ class Supplier extends AbstractCompany
*/
public function setShippingCosts(?BigDecimal $shipping_costs): self
{
- if (!$shipping_costs instanceof \Brick\Math\BigDecimal) {
+ if (!$shipping_costs instanceof BigDecimal) {
$this->shipping_costs = null;
}
@@ -142,9 +148,9 @@ class Supplier extends AbstractCompany
public function __construct()
{
parent::__construct();
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->orderdetails = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->orderdetails = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
}
}
diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php
index 106cb052..ea14cfcc 100644
--- a/src/Entity/PriceInformations/Currency.php
+++ b/src/Entity/PriceInformations/Currency.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\PriceInformations;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\CurrencyParameter;
@@ -60,7 +61,7 @@ class Currency extends AbstractStructuralDBElement
*/
#[Assert\Currency]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $iso_code = "";
#[ORM\OneToMany(targetEntity: 'Currency', mappedBy: 'parent', cascade: ['persist'])]
@@ -75,27 +76,27 @@ class Currency extends AbstractStructuralDBElement
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
/** @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Pricedetail::class, mappedBy: 'currency')]
+ #[ORM\OneToMany(targetEntity: Pricedetail::class, mappedBy: 'currency')]
protected Collection $pricedetails;
public function __construct()
{
- $this->children = new \Doctrine\Common\Collections\ArrayCollection();
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->children = new ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
$this->pricedetails = new ArrayCollection();
parent::__construct();
}
@@ -129,7 +130,7 @@ class Currency extends AbstractStructuralDBElement
{
$tmp = $this->getExchangeRate();
- if (!$tmp instanceof \Brick\Math\BigDecimal || $tmp->isZero()) {
+ if (!$tmp instanceof BigDecimal || $tmp->isZero()) {
return null;
}
@@ -153,7 +154,7 @@ class Currency extends AbstractStructuralDBElement
*/
public function setExchangeRate(?BigDecimal $exchange_rate): self
{
- if (!$exchange_rate instanceof \Brick\Math\BigDecimal) {
+ if (!$exchange_rate instanceof BigDecimal) {
$this->exchange_rate = null;
}
$tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP);
diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php
index 9feec023..f39690d4 100644
--- a/src/Entity/PriceInformations/Orderdetail.php
+++ b/src/Entity/PriceInformations/Orderdetail.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Entity\PriceInformations;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
use App\Entity\Contracts\NamedElementInterface;
@@ -59,14 +60,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @var string
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $supplierpartnr = '';
/**
* @var bool
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $obsolete = false;
/**
@@ -74,14 +75,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
*/
#[Assert\Url]
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $supplier_product_url = '';
/**
* @var Part|null
*/
#[Assert\NotNull]
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'orderdetails')]
+ #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'orderdetails')]
#[ORM\JoinColumn(name: 'part_id', nullable: false, onDelete: 'CASCADE')]
protected ?Part $part = null;
@@ -90,7 +91,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
*/
#[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'orderdetails')]
+ #[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'orderdetails')]
#[ORM\JoinColumn(name: 'id_supplier')]
protected ?Supplier $supplier = null;
@@ -194,7 +195,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
return $this->supplier_product_url;
}
- if (!$this->getSupplier() instanceof \App\Entity\Parts\Supplier) {
+ if (!$this->getSupplier() instanceof Supplier) {
return '';
}
diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php
index d0f97929..9847b41a 100644
--- a/src/Entity/PriceInformations/Pricedetail.php
+++ b/src/Entity/PriceInformations/Pricedetail.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\PriceInformations;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
use App\Entity\Contracts\TimeStampableInterface;
@@ -73,7 +74,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*/
#[Assert\Positive]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
+ #[ORM\Column(type: Types::FLOAT)]
protected float $price_related_quantity = 1.0;
/**
@@ -81,13 +82,13 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*/
#[Assert\Positive]
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
+ #[ORM\Column(type: Types::FLOAT)]
protected float $min_discount_quantity = 1.0;
/**
* @var bool
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $manual_input = true;
/**
@@ -166,7 +167,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*
* @return BigDecimal the price as a bcmath string
*/
- public function getPricePerUnit(float|string|\Brick\Math\BigDecimal $multiplier = 1.0): BigDecimal
+ public function getPricePerUnit(float|string|BigDecimal $multiplier = 1.0): BigDecimal
{
$tmp = BigDecimal::of($multiplier);
$tmp = $tmp->multipliedBy($this->price);
diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php
index a2b920ca..24cc2b25 100644
--- a/src/Entity/ProjectSystem/Project.php
+++ b/src/Entity/ProjectSystem/Project.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\Entity\ProjectSystem;
+use App\Repository\Parts\DeviceRepository;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\ProjectAttachment;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\ProjectParameter;
@@ -37,7 +39,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Class AttachmentType.
*/
-#[ORM\Entity(repositoryClass: \App\Repository\Parts\DeviceRepository::class)]
+#[ORM\Entity(repositoryClass: DeviceRepository::class)]
#[ORM\Table(name: 'projects')]
class Project extends AbstractStructuralDBElement
{
@@ -57,7 +59,7 @@ class Project extends AbstractStructuralDBElement
#[ORM\OneToMany(targetEntity: 'ProjectBOMEntry', mappedBy: 'project', cascade: ['persist', 'remove'], orphanRemoval: true)]
protected Collection $bom_entries;
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
protected int $order_quantity = 0;
/**
@@ -65,33 +67,33 @@ class Project extends AbstractStructuralDBElement
*/
#[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])]
#[Groups(['extended', 'full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 64, nullable: true)]
+ #[ORM\Column(type: Types::STRING, length: 64, nullable: true)]
protected ?string $status = null;
/**
* @var Part|null The (optional) part that represents the builds of this project in the stock
*/
- #[ORM\OneToOne(targetEntity: \App\Entity\Parts\Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)]
+ #[ORM\OneToOne(targetEntity: Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)]
protected ?Part $build_part = null;
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $order_only_missing_parts = false;
#[Groups(['simple', 'extended', 'full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $description = '';
/**
* @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
@@ -103,8 +105,8 @@ class Project extends AbstractStructuralDBElement
public function __construct()
{
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
parent::__construct();
$this->bom_entries = new ArrayCollection();
$this->children = new ArrayCollection();
@@ -241,7 +243,7 @@ class Project extends AbstractStructuralDBElement
*/
public function hasBuildPart(): bool
{
- return $this->build_part instanceof \App\Entity\Parts\Part;
+ return $this->build_part instanceof Part;
}
/**
@@ -258,7 +260,7 @@ class Project extends AbstractStructuralDBElement
public function setBuildPart(?Part $build_part): void
{
$this->build_part = $build_part;
- if ($build_part instanceof \App\Entity\Parts\Part) {
+ if ($build_part instanceof Part) {
$build_part->setBuiltProject($this);
}
}
@@ -269,7 +271,7 @@ class Project extends AbstractStructuralDBElement
//If this project has subprojects, and these have builds part, they must be included in the BOM
foreach ($this->getChildren() as $child) {
/** @var $child Project */
- if (!$child->getBuildPart() instanceof \App\Entity\Parts\Part) {
+ if (!$child->getBuildPart() instanceof Part) {
continue;
}
//We have to search all bom entries for the build part
diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php
index 4d432f75..0898f69f 100644
--- a/src/Entity/ProjectSystem/ProjectBOMEntry.php
+++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\ProjectSystem;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
use App\Entity\Parts\Part;
@@ -50,26 +51,26 @@ class ProjectBOMEntry extends AbstractDBElement
* @var float
*/
#[Assert\Positive]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'quantity')]
+ #[ORM\Column(type: Types::FLOAT, name: 'quantity')]
protected float $quantity;
/**
* @var string A comma separated list of the names, where this parts should be placed
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'mountnames')]
+ #[ORM\Column(type: Types::TEXT, name: 'mountnames')]
protected string $mountnames = '';
/**
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
*/
#[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
+ #[ORM\Column(type: Types::STRING, nullable: true)]
protected ?string $name = null;
/**
* @var string An optional comment for this BOM entry
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $comment;
/**
@@ -82,7 +83,7 @@ class ProjectBOMEntry extends AbstractDBElement
/**
* @var Part|null The part associated with this
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'project_bom_entries')]
+ #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'project_bom_entries')]
#[ORM\JoinColumn(name: 'id_part')]
protected ?Part $part = null;
@@ -97,7 +98,7 @@ class ProjectBOMEntry extends AbstractDBElement
* @var ?Currency The currency for the price of this non-part BOM entry
* @Selectable()
*/
- #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)]
+ #[ORM\ManyToOne(targetEntity: Currency::class)]
#[ORM\JoinColumn]
protected ?Currency $price_currency = null;
@@ -213,18 +214,18 @@ class ProjectBOMEntry extends AbstractDBElement
*/
public function isPartBomEntry(): bool
{
- return $this->part instanceof \App\Entity\Parts\Part;
+ return $this->part instanceof Part;
}
#[Assert\Callback]
public function validate(ExecutionContextInterface $context, $payload): void
{
//Round quantity to whole numbers, if the part is not a decimal part
- if ($this->part instanceof \App\Entity\Parts\Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) {
+ if ($this->part instanceof Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) {
$this->quantity = round($this->quantity);
}
//Non-Part BOM entries are rounded
- if (!$this->part instanceof \App\Entity\Parts\Part) {
+ if (!$this->part instanceof Part) {
$this->quantity = round($this->quantity);
}
@@ -248,14 +249,14 @@ class ProjectBOMEntry extends AbstractDBElement
}
//Prices are only allowed on non-part BOM entries
- if ($this->part instanceof \App\Entity\Parts\Part && $this->price instanceof \Brick\Math\BigDecimal) {
+ if ($this->part instanceof Part && $this->price instanceof BigDecimal) {
$context->buildViolation('project.bom_entry.price_not_allowed_on_parts')
->atPath('price')
->addViolation();
}
//Check that the part is not the build representation part of this device or one of its parents
- if ($this->part && $this->part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) {
+ if ($this->part && $this->part->getBuiltProject() instanceof Project) {
//Get the associated project
$associated_project = $this->part->getBuiltProject();
//Check that it is not the same as the current project neither one of its parents
diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php
index 6207e25c..6dceec58 100644
--- a/src/Entity/UserSystem/Group.php
+++ b/src/Entity/UserSystem/Group.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\UserSystem;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\GroupAttachment;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parameters\GroupParameter;
@@ -63,13 +64,13 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
* @var bool If true all users associated with this group must have enabled some kind of two-factor authentication
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'enforce_2fa')]
+ #[ORM\Column(type: Types::BOOLEAN, name: 'enforce_2fa')]
protected bool $enforce2FA = false;
/**
* @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
@@ -84,14 +85,14 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
/** @var Collection
*/
#[Assert\Valid]
- #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
public function __construct()
{
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
- $this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->attachments = new ArrayCollection();
+ $this->parameters = new ArrayCollection();
parent::__construct();
$this->permissions = new PermissionData();
$this->users = new ArrayCollection();
@@ -122,7 +123,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
public function getPermissions(): PermissionData
{
- if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) {
+ if (!$this->permissions instanceof PermissionData) {
$this->permissions = new PermissionData();
}
diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php
index 65101ee9..5c4e84c5 100644
--- a/src/Entity/UserSystem/PermissionData.php
+++ b/src/Entity/UserSystem/PermissionData.php
@@ -20,6 +20,7 @@
namespace App\Entity\UserSystem;
+use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
@@ -52,7 +53,7 @@ final class PermissionData implements \JsonSerializable
* operation => value,
* ]
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'data')]
+ #[ORM\Column(type: Types::JSON, name: 'data')]
protected array $data = [])
{
//If the passed data did not contain a schema version, we set it to the current version
diff --git a/src/Entity/UserSystem/U2FKey.php b/src/Entity/UserSystem/U2FKey.php
index fefbbe20..5cf5b7da 100644
--- a/src/Entity/UserSystem/U2FKey.php
+++ b/src/Entity/UserSystem/U2FKey.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\UserSystem;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\TimestampTrait;
use Doctrine\ORM\Mapping as ORM;
use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface;
@@ -41,39 +42,39 @@ class U2FKey implements LegacyU2FKeyInterface
*
* @var string
**/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 128)]
+ #[ORM\Column(type: Types::STRING, length: 128)]
public string $keyHandle;
/**
* @var string
**/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
public string $publicKey;
/**
* @var string
**/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
public string $certificate;
/**
* @var int
**/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
public int $counter;
#[ORM\Id]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
#[ORM\GeneratedValue]
protected int $id;
/**
* @var string
**/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $name;
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'u2fKeys')]
+ #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'u2fKeys')]
protected ?User $user = null;
public function getKeyHandle(): string
diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php
index b7badde3..c1cd9a26 100644
--- a/src/Entity/UserSystem/User.php
+++ b/src/Entity/UserSystem/User.php
@@ -22,6 +22,9 @@ declare(strict_types=1);
namespace App\Entity\UserSystem;
+use App\Repository\UserRepository;
+use App\EntityListeners\TreeCacheInvalidationListener;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\UserAttachment;
use App\Entity\Base\AbstractNamedDBElement;
@@ -56,8 +59,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
* Also, this entity is able to save some information about the user, like the names, email-address and other info.
*/
#[UniqueEntity('name', message: 'validator.user.username_already_used')]
-#[ORM\Entity(repositoryClass: \App\Repository\UserRepository::class)]
-#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])]
+#[ORM\Entity(repositoryClass: UserRepository::class)]
+#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
#[ORM\Table('`users`')]
#[ORM\Index(name: 'user_idx_username', columns: ['name'])]
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface,
@@ -74,7 +77,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @var bool Determines if the user is disabled (user can not log in)
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $disabled = false;
/**
@@ -82,42 +85,42 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @ValidTheme()
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_theme', nullable: true)]
+ #[ORM\Column(type: Types::STRING, name: 'config_theme', nullable: true)]
protected ?string $theme = null;
/**
* @var string|null the hash of a token the user must provide when he wants to reset his password
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
+ #[ORM\Column(type: Types::STRING, nullable: true)]
protected ?string $pw_reset_token = null;
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_a')]
+ #[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_a')]
protected string $instock_comment_a = '';
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_w')]
+ #[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_w')]
protected string $instock_comment_w = '';
/**
* @var string A self-description of the user
*/
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
+ #[ORM\Column(type: Types::TEXT)]
protected string $aboutMe = '';
/** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once.
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
protected int $trustedDeviceCookieVersion = 0;
/**
* @var string[]|null A list of backup codes that can be used, if the user has no access to its Google Authenticator device
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
+ #[ORM\Column(type: Types::JSON)]
protected ?array $backupCodes = [];
#[ORM\Id]
#[ORM\GeneratedValue]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
protected ?int $id = null;
/**
@@ -133,7 +136,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* @var string|null The secret used for Google authenticator
*/
- #[ORM\Column(name: 'google_authenticator_secret', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
+ #[ORM\Column(name: 'google_authenticator_secret', type: Types::STRING, nullable: true)]
protected ?string $googleAuthenticatorSecret = null;
/**
@@ -141,7 +144,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
*/
#[Assert\Timezone]
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_timezone', nullable: true)]
+ #[ORM\Column(type: Types::STRING, name: 'config_timezone', nullable: true)]
protected ?string $timezone = '';
/**
@@ -149,7 +152,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
*/
#[Assert\Language]
#[Groups(['full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_language', nullable: true)]
+ #[ORM\Column(type: Types::STRING, name: 'config_language', nullable: true)]
protected ?string $language = '';
/**
@@ -157,82 +160,82 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
*/
#[Assert\Email]
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
+ #[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
protected ?string $email = '';
/**
* @var bool True if the user wants to show his email address on his (public) profile
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
+ #[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
protected bool $show_email_on_profile = false;
/**
* @var string|null The department the user is working
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
+ #[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
protected ?string $department = '';
/**
* @var string|null The last name of the User
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
+ #[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
protected ?string $last_name = '';
/**
* @var string|null The first name of the User
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
+ #[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
protected ?string $first_name = '';
/**
* @var bool True if the user needs to change password after log in
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $need_pw_change = true;
/**
* @var string|null The hashed password
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
+ #[ORM\Column(type: Types::STRING, nullable: true)]
protected ?string $password = null;
#[Assert\NotBlank]
#[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180, unique: true)]
+ #[ORM\Column(type: Types::STRING, length: 180, unique: true)]
protected string $name = '';
/**
* @var array|null
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
+ #[ORM\Column(type: Types::JSON)]
protected ?array $settings = [];
/**
* @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
/** @var \DateTimeInterface|null The time when the backup codes were generated
*/
#[Groups(['full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
+ #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
protected ?\DateTimeInterface $backupCodesGenerationDate = null;
/** @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
protected Collection $u2fKeys;
/**
* @var Collection
*/
- #[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
protected Collection $webauthn_keys;
/**
@@ -243,7 +246,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @Selectable()
*/
#[Groups(['extended', 'full', 'import'])]
- #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)]
+ #[ORM\ManyToOne(targetEntity: Currency::class)]
#[ORM\JoinColumn(name: 'currency_id')]
protected ?Currency $currency = null;
@@ -258,19 +261,19 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* @var \DateTimeInterface|null the time until the password reset token is valid
*/
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
+ #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
protected ?\DateTimeInterface $pw_reset_expires = null;
/**
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)
*/
#[Groups(['extended', 'full'])]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
+ #[ORM\Column(type: Types::BOOLEAN)]
protected bool $saml_user = false;
public function __construct()
{
- $this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->attachments = new ArrayCollection();
parent::__construct();
$this->permissions = new PermissionData();
$this->u2fKeys = new ArrayCollection();
@@ -419,7 +422,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
public function getPermissions(): PermissionData
{
- if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) {
+ if (!$this->permissions instanceof PermissionData) {
$this->permissions = new PermissionData();
}
diff --git a/src/Entity/UserSystem/WebauthnKey.php b/src/Entity/UserSystem/WebauthnKey.php
index 82a0a5fe..2098bd67 100644
--- a/src/Entity/UserSystem/WebauthnKey.php
+++ b/src/Entity/UserSystem/WebauthnKey.php
@@ -20,6 +20,7 @@
namespace App\Entity\UserSystem;
+use Doctrine\DBAL\Types\Types;
use App\Entity\Base\TimestampTrait;
use Doctrine\ORM\Mapping as ORM;
use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource;
@@ -32,14 +33,14 @@ class WebauthnKey extends BasePublicKeyCredentialSource
use TimestampTrait;
#[ORM\Id]
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
+ #[ORM\Column(type: Types::INTEGER)]
#[ORM\GeneratedValue]
protected int $id;
- #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
+ #[ORM\Column(type: Types::STRING)]
protected string $name;
- #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'webauthn_keys')]
+ #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'webauthn_keys')]
protected ?User $user = null;
public function getName(): string
diff --git a/src/EntityListeners/AttachmentDeleteListener.php b/src/EntityListeners/AttachmentDeleteListener.php
index 11ddd794..e9df5972 100644
--- a/src/EntityListeners/AttachmentDeleteListener.php
+++ b/src/EntityListeners/AttachmentDeleteListener.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\EntityListeners;
+use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\Attachment;
use App\Services\Attachments\AttachmentManager;
use App\Services\Attachments\AttachmentPathResolver;
@@ -80,7 +81,7 @@ class AttachmentDeleteListener
//Ensure that the attachment that will be deleted, is not used as preview picture anymore...
$attachment_holder = $attachment->getElement();
- if (!$attachment_holder instanceof \App\Entity\Attachments\AttachmentContainingDBElement) {
+ if (!$attachment_holder instanceof AttachmentContainingDBElement) {
return;
}
diff --git a/src/EventListener/LogSystem/LogLogoutEventListener.php b/src/EventSubscriber/LogSystem/LogLogoutEventSubscriber.php
similarity index 71%
rename from src/EventListener/LogSystem/LogLogoutEventListener.php
rename to src/EventSubscriber/LogSystem/LogLogoutEventSubscriber.php
index eab278b4..87d97b1e 100644
--- a/src/EventListener/LogSystem/LogLogoutEventListener.php
+++ b/src/EventSubscriber/LogSystem/LogLogoutEventSubscriber.php
@@ -20,8 +20,10 @@
declare(strict_types=1);
-namespace App\EventListener\LogSystem;
+namespace App\EventSubscriber\LogSystem;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use App\Entity\LogSystem\UserLogoutLogEntry;
use App\Entity\UserSystem\User;
use App\Services\LogSystem\EventLogger;
@@ -31,19 +33,18 @@ use Symfony\Component\Security\Http\Event\LogoutEvent;
/**
* This handler logs to event log, if a user logs out.
*/
-#[AsEventListener]
-final class LogLogoutEventListener
+final class LogLogoutEventSubscriber implements EventSubscriberInterface
{
- public function __construct(private EventLogger $logger, private readonly bool $gdpr_compliance)
+ public function __construct(private readonly EventLogger $logger, private readonly bool $gdpr_compliance)
{
}
- public function __invoke(LogoutEvent $event): void
+ public function logLogout(LogoutEvent $event): void
{
$request = $event->getRequest();
$token = $event->getToken();
- if (!$token instanceof \Symfony\Component\Security\Core\Authentication\Token\TokenInterface) {
+ if (!$token instanceof TokenInterface) {
return;
}
@@ -55,5 +56,12 @@ final class LogLogoutEventListener
$this->logger->logAndFlush($log);
}
+ /**
+ * @return array
+ */
+ public static function getSubscribedEvents(): array
+ {
+ return [LogoutEvent::class => 'logLogout'];
+ }
}
diff --git a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php
index 28cf7b48..78941cd5 100644
--- a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php
+++ b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php
@@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\EventSubscriber\LogSystem;
+use Symfony\Component\HttpFoundation\Request;
use App\Entity\LogSystem\SecurityEventLogEntry;
use App\Events\SecurityEvent;
use App\Events\SecurityEvents;
@@ -122,7 +123,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
$anonymize = $this->gdpr_compliance;
$request = $this->requestStack->getCurrentRequest();
- if ($request instanceof \Symfony\Component\HttpFoundation\Request) {
+ if ($request instanceof Request) {
$ip = $request->getClientIp() ?? 'unknown';
} else {
$ip = 'Console';
diff --git a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php
index da8d3b94..33c5e919 100644
--- a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php
+++ b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php
@@ -22,13 +22,13 @@ declare(strict_types=1);
namespace App\EventSubscriber\UserSystem;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\UserSystem\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Security\Core\Security;
/**
* This subscriber is used to log out a disabled user, as soon as he to do a request.
@@ -36,7 +36,7 @@ use Symfony\Component\Security\Core\Security;
*/
final class LogoutDisabledUserSubscriber implements EventSubscriberInterface
{
- public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator)
+ public function __construct(private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator)
{
}
diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php
index db8b6575..0f12c6d9 100644
--- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php
+++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\EventSubscriber\UserSystem;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
@@ -29,7 +31,6 @@ use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
-use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Http\HttpUtils;
/**
@@ -56,7 +57,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
*/
public const REDIRECT_TARGET = 'user_settings';
- public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly HttpUtils $httpUtils)
+ public function __construct(private readonly Security $security, private readonly HttpUtils $httpUtils)
{
}
@@ -125,7 +126,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
{
$tfa_enabled = $user->isWebAuthnAuthenticatorEnabled() || $user->isGoogleAuthenticatorEnabled();
- return $user->getGroup() instanceof \App\Entity\UserSystem\Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
+ return $user->getGroup() instanceof Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
}
public static function getSubscribedEvents(): array
diff --git a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php
index b2f30b01..3997c050 100644
--- a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php
+++ b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php
@@ -20,6 +20,8 @@
namespace App\EventSubscriber\UserSystem;
+use Symfony\Bundle\SecurityBundle\Security;
+use Symfony\Component\Security\Core\User\UserInterface;
use App\Entity\UserSystem\User;
use App\Services\LogSystem\EventCommentHelper;
use App\Services\UserSystem\PermissionSchemaUpdater;
@@ -28,14 +30,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
-use Symfony\Component\Security\Core\Security;
/**
* The purpose of this event subscriber is to check if the permission schema of the current user is up-to-date and upgrade it automatically if needed.
*/
class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
{
- public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper)
+ public function __construct(private readonly Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper)
{
}
@@ -46,7 +47,7 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
}
$user = $this->security->getUser();
- if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
+ if (!$user instanceof UserInterface) {
//Retrieve anonymous user
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
}
diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php
index c2ea1c00..d777d4d4 100644
--- a/src/Form/AdminPages/AttachmentTypeAdminForm.php
+++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php
@@ -22,17 +22,17 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractNamedDBElement;
use App\Services\Attachments\FileTypeFilterTools;
use App\Services\LogSystem\EventCommentNeededHelper;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\Security\Core\Security;
class AttachmentTypeAdminForm extends BaseEntityAdminForm
{
- public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, protected FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper)
+ public function __construct(Security $security, protected FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper)
{
parent::__construct($security, $eventCommentNeededHelper);
}
diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php
index 464e32ad..268ea630 100644
--- a/src/Form/AdminPages/BaseEntityAdminForm.php
+++ b/src/Form/AdminPages/BaseEntityAdminForm.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\LabelSystem\LabelProfile;
@@ -40,11 +41,10 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
class BaseEntityAdminForm extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected EventCommentNeededHelper $eventCommentNeededHelper)
+ public function __construct(protected Security $security, protected EventCommentNeededHelper $eventCommentNeededHelper)
{
}
diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php
index d6c5f590..a3514b80 100644
--- a/src/Form/AdminPages/CurrencyAdminForm.php
+++ b/src/Form/AdminPages/CurrencyAdminForm.php
@@ -22,17 +22,17 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractNamedDBElement;
use App\Form\Type\BigDecimalMoneyType;
use App\Services\LogSystem\EventCommentNeededHelper;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\Security\Core\Security;
class CurrencyAdminForm extends BaseEntityAdminForm
{
- public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $base_currency)
+ public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $base_currency)
{
parent::__construct($security, $eventCommentNeededHelper);
}
diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php
index ceaa0c0c..3e87812c 100644
--- a/src/Form/AdminPages/ImportType.php
+++ b/src/Form/AdminPages/ImportType.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parts\Category;
use App\Entity\Parts\Part;
@@ -33,11 +34,10 @@ use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\Security\Core\Security;
class ImportType extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected Security $security)
{
}
diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php
index dbf3fbcb..4948cdd5 100644
--- a/src/Form/AdminPages/MassCreationForm.php
+++ b/src/Form/AdminPages/MassCreationForm.php
@@ -22,17 +22,17 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\Security\Core\Security;
class MassCreationForm extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected Security $security)
{
}
diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php
index 02efd45f..34b3b27a 100644
--- a/src/Form/AdminPages/SupplierForm.php
+++ b/src/Form/AdminPages/SupplierForm.php
@@ -22,17 +22,17 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\PriceInformations\Currency;
use App\Form\Type\BigDecimalMoneyType;
use App\Form\Type\StructuralEntityType;
use App\Services\LogSystem\EventCommentNeededHelper;
use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\Security\Core\Security;
class SupplierForm extends CompanyForm
{
- public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $base_currency)
+ public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $base_currency)
{
parent::__construct($security, $eventCommentNeededHelper);
}
diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php
index 88d4d3d1..ea96666a 100644
--- a/src/Form/AttachmentFormType.php
+++ b/src/Form/AttachmentFormType.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType;
use App\Form\Type\StructuralEntityType;
@@ -41,14 +42,13 @@ use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\Url;
use Symfony\Contracts\Translation\TranslatorInterface;
class AttachmentFormType extends AbstractType
{
- public function __construct(protected AttachmentManager $attachment_helper, protected UrlGeneratorInterface $urlGenerator, protected \Symfony\Bundle\SecurityBundle\Security $security, protected AttachmentSubmitHandler $submitHandler, protected TranslatorInterface $translator, protected bool $allow_attachments_download, protected string $max_file_size)
+ public function __construct(protected AttachmentManager $attachment_helper, protected UrlGeneratorInterface $urlGenerator, protected Security $security, protected AttachmentSubmitHandler $submitHandler, protected TranslatorInterface $translator, protected bool $allow_attachments_download, protected string $max_file_size)
{
}
diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php
index 25c3c646..38490c2b 100644
--- a/src/Form/LabelOptionsType.php
+++ b/src/Form/LabelOptionsType.php
@@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\Form;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\LabelSystem\LabelOptions;
use App\Form\Type\RichTextEditorType;
use Symfony\Component\Form\AbstractType;
@@ -49,11 +50,10 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
class LabelOptionsType extends AbstractType
{
- public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(private readonly Security $security)
{
}
diff --git a/src/Form/LabelSystem/LabelDialogType.php b/src/Form/LabelSystem/LabelDialogType.php
index faf12adb..33c79797 100644
--- a/src/Form/LabelSystem/LabelDialogType.php
+++ b/src/Form/LabelSystem/LabelDialogType.php
@@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\Form\LabelSystem;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Form\LabelOptionsType;
use App\Validator\Constraints\Misc\ValidRange;
use Symfony\Component\Form\AbstractType;
@@ -48,11 +49,10 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
class LabelDialogType extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected Security $security)
{
}
diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php
index 67d2aa82..53240821 100644
--- a/src/Form/Part/OrderdetailType.php
+++ b/src/Form/Part/OrderdetailType.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form\Part;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Orderdetail;
@@ -36,11 +37,10 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
class OrderdetailType extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected Security $security)
{
}
@@ -79,7 +79,7 @@ class OrderdetailType extends AbstractType
$orderdetail = $event->getData();
$dummy_pricedetail = new Pricedetail();
- if ($orderdetail instanceof \App\Entity\PriceInformations\Orderdetail && $orderdetail->getSupplier() instanceof \App\Entity\Parts\Supplier) {
+ if ($orderdetail instanceof Orderdetail && $orderdetail->getSupplier() instanceof Supplier) {
$dummy_pricedetail->setCurrency($orderdetail->getSupplier()->getDefaultCurrency());
}
diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php
index 53205e1f..309197ab 100644
--- a/src/Form/Part/PartBaseType.php
+++ b/src/Form/Part/PartBaseType.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form\Part;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Parameters\PartParameter;
use App\Entity\Parts\Category;
@@ -48,11 +49,10 @@ use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Security\Core\Security;
class PartBaseType extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected UrlGeneratorInterface $urlGenerator, protected EventCommentNeededHelper $event_comment_needed_helper)
+ public function __construct(protected Security $security, protected UrlGeneratorInterface $urlGenerator, protected EventCommentNeededHelper $event_comment_needed_helper)
{
}
diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php
index d845b2c4..707caf28 100644
--- a/src/Form/Part/PartLotType.php
+++ b/src/Form/Part/PartLotType.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form\Part;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
@@ -34,11 +35,10 @@ use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
class PartLotType extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected Security $security)
{
}
diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php
index 6d6a194a..28c7c18a 100644
--- a/src/Form/ProjectSystem/ProjectBuildType.php
+++ b/src/Form/ProjectSystem/ProjectBuildType.php
@@ -20,6 +20,8 @@
namespace App\Form\ProjectSystem;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Form\Type\PartLotSelectType;
use App\Form\Type\SIUnitType;
@@ -34,11 +36,10 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
class ProjectBuildType extends AbstractType implements DataMapperInterface
{
- public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(private readonly Security $security)
{
}
@@ -76,10 +77,10 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface
$form->add('addBuildsToBuildsPart', CheckboxType::class, [
'label' => 'project.build.add_builds_to_builds_part',
'required' => false,
- 'disabled' => !$build_request->getProject()->getBuildPart() instanceof \App\Entity\Parts\Part,
+ 'disabled' => !$build_request->getProject()->getBuildPart() instanceof Part,
]);
- if ($build_request->getProject()->getBuildPart() instanceof \App\Entity\Parts\Part) {
+ if ($build_request->getProject()->getBuildPart() instanceof Part) {
$form->add('buildsPartLot', PartLotSelectType::class, [
'label' => 'project.build.builds_part_lot',
'required' => false,
diff --git a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php
index 3540e892..57fb9237 100644
--- a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php
+++ b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php
@@ -20,6 +20,7 @@
namespace App\Form\Type\Helper;
+use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractNamedDBElement;
@@ -42,7 +43,7 @@ class StructuralEntityChoiceHelper
* Generates the choice attributes for the given AbstractStructuralDBElement.
* @return array|string[]
*/
- public function generateChoiceAttr(AbstractNamedDBElement $choice, \Symfony\Component\OptionsResolver\Options|array $options): array
+ public function generateChoiceAttr(AbstractNamedDBElement $choice, Options|array $options): array
{
$tmp = [
'data-level' => 0,
@@ -62,19 +63,19 @@ class StructuralEntityChoiceHelper
$level = $choice->getLevel();
/** @var AbstractStructuralDBElement|null $parent */
$parent = $options['subentities_of'] ?? null;
- if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) {
+ if ($parent instanceof AbstractStructuralDBElement) {
$level -= $parent->getLevel() - 1;
}
$tmp += [
'data-level' => $level,
- 'data-parent' => $choice->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $choice->getParent()->getFullPath() : null,
+ 'data-parent' => $choice->getParent() instanceof AbstractStructuralDBElement ? $choice->getParent()->getFullPath() : null,
'data-path' => $choice->getFullPath('->'),
];
}
if ($choice instanceof HasMasterAttachmentInterface) {
- $tmp['data-image'] = $choice->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment ?
+ $tmp['data-image'] = $choice->getMasterPictureAttachment() instanceof Attachment ?
$this->attachmentURLGenerator->getThumbnailURL($choice->getMasterPictureAttachment(),
'thumbnail_xs')
: null
@@ -92,7 +93,7 @@ class StructuralEntityChoiceHelper
* Generates the choice attributes for the given AbstractStructuralDBElement.
* @return array|string[]
*/
- public function generateChoiceAttrCurrency(Currency $choice, \Symfony\Component\OptionsResolver\Options|array $options): array
+ public function generateChoiceAttrCurrency(Currency $choice, Options|array $options): array
{
$tmp = $this->generateChoiceAttr($choice, $options);
$symbol = empty($choice->getIsoCode()) ? null : Currencies::getSymbol($choice->getIsoCode());
@@ -116,7 +117,7 @@ class StructuralEntityChoiceHelper
*/
public function generateChoiceValue(?AbstractNamedDBElement $element): string|int|null
{
- if (!$element instanceof \App\Entity\Base\AbstractNamedDBElement) {
+ if (!$element instanceof AbstractNamedDBElement) {
return null;
}
diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php
index 2f15443e..bc8d0d84 100644
--- a/src/Form/Type/PartLotSelectType.php
+++ b/src/Form/Type/PartLotSelectType.php
@@ -20,6 +20,7 @@
namespace App\Form\Type;
+use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use Doctrine\ORM\EntityRepository;
@@ -43,7 +44,7 @@ class PartLotSelectType extends AbstractType
$resolver->setDefaults([
'class' => PartLot::class,
- 'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $part_lot->getStorageLocation()->getFullPath() : '')
+ 'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof Storelocation ? $part_lot->getStorageLocation()->getFullPath() : '')
. ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount()),
'query_builder' => fn(Options $options) => static fn(EntityRepository $er) => $er->createQueryBuilder('l')
->where('l.part = :part')
diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php
index d81f70cd..cbbe9668 100644
--- a/src/Form/Type/PartSelectType.php
+++ b/src/Form/Type/PartSelectType.php
@@ -2,6 +2,9 @@
namespace App\Form\Type;
+use App\Entity\Attachments\Attachment;
+use App\Entity\Parts\Category;
+use App\Entity\Parts\Footprint;
use App\Entity\Parts\Part;
use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\Attachments\PartPreviewGenerator;
@@ -86,10 +89,10 @@ class PartSelectType extends AbstractType implements DataMapperInterface
$resolver->setDefaults([
//Prefill the selected choice with the needed data, so the user can see it without an additional Ajax request
'choice_attr' => ChoiceList::attr($this, function (?Part $part) {
- if($part instanceof \App\Entity\Parts\Part) {
+ if($part instanceof Part) {
//Determine the picture to show:
$preview_attachment = $this->previewGenerator->getTablePreviewAttachment($part);
- if ($preview_attachment instanceof \App\Entity\Attachments\Attachment) {
+ if ($preview_attachment instanceof Attachment) {
$preview_url = $this->attachmentURLGenerator->getThumbnailURL($preview_attachment,
'thumbnail_sm');
} else {
@@ -97,10 +100,10 @@ class PartSelectType extends AbstractType implements DataMapperInterface
}
}
- return $part instanceof \App\Entity\Parts\Part ? [
+ return $part instanceof Part ? [
'data-description' => mb_strimwidth($part->getDescription(), 0, 127, '...'),
- 'data-category' => $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : '',
- 'data-footprint' => $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '',
+ 'data-category' => $part->getCategory() instanceof Category ? $part->getCategory()->getName() : '',
+ 'data-footprint' => $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getName() : '',
'data-image' => $preview_url,
] : [];
})
diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php
index 2b690619..f8fcc7c6 100644
--- a/src/Form/UserAdminForm.php
+++ b/src/Form/UserAdminForm.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
@@ -43,12 +44,11 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\Length;
class UserAdminForm extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected Security $security)
{
}
diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php
index 07b4a38a..53ca8cf8 100644
--- a/src/Form/UserSettingsType.php
+++ b/src/Form/UserSettingsType.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\UserSystem\User;
use App\Form\Type\CurrencyEntityType;
use App\Form\Type\RichTextEditorType;
@@ -39,12 +40,11 @@ use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\File;
class UserSettingsType extends AbstractType
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected bool $demo_mode)
+ public function __construct(protected Security $security, protected bool $demo_mode)
{
}
diff --git a/src/Helpers/Projects/ProjectBuildRequest.php b/src/Helpers/Projects/ProjectBuildRequest.php
index d29cf303..f231c50f 100644
--- a/src/Helpers/Projects/ProjectBuildRequest.php
+++ b/src/Helpers/Projects/ProjectBuildRequest.php
@@ -20,6 +20,7 @@
namespace App\Helpers\Projects;
+use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\ProjectSystem\Project;
use App\Entity\ProjectSystem\ProjectBOMEntry;
@@ -57,7 +58,7 @@ final class ProjectBuildRequest
$this->initializeArray();
//By default, use the first available lot of builds part if there is one.
- if($project->getBuildPart() instanceof \App\Entity\Parts\Part) {
+ if($project->getBuildPart() instanceof Part) {
$this->add_build_to_builds_part = true;
foreach( $project->getBuildPart()->getPartLots() as $lot) {
if (!$lot->isInstockUnknown()) {
@@ -133,11 +134,11 @@ final class ProjectBuildRequest
public function setBuildsPartLot(?PartLot $new_part_lot): self
{
//Ensure that this new_part_lot belongs to the project
- if (($new_part_lot instanceof \App\Entity\Parts\PartLot && $new_part_lot->getPart() !== $this->project->getBuildPart()) || !$this->project->getBuildPart() instanceof \App\Entity\Parts\Part) {
+ if (($new_part_lot instanceof PartLot && $new_part_lot->getPart() !== $this->project->getBuildPart()) || !$this->project->getBuildPart() instanceof Part) {
throw new \InvalidArgumentException('The given part lot does not belong to the projects build part!');
}
- if ($new_part_lot instanceof \App\Entity\Parts\PartLot) {
+ if ($new_part_lot instanceof PartLot) {
$this->setAddBuildsToBuildsPart(true);
}
@@ -166,7 +167,7 @@ final class ProjectBuildRequest
* Returns the amount of parts that should be withdrawn from the given lot for the corresponding BOM entry.
* @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got
*/
- public function getLotWithdrawAmount(\App\Entity\Parts\PartLot|int $lot): float
+ public function getLotWithdrawAmount(PartLot|int $lot): float
{
if ($lot instanceof PartLot) {
$lot_id = $lot->getID();
@@ -188,7 +189,7 @@ final class ProjectBuildRequest
* @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got
* @return $this
*/
- public function setLotWithdrawAmount(\App\Entity\Parts\PartLot|int $lot, float $amount): self
+ public function setLotWithdrawAmount(PartLot|int $lot, float $amount): self
{
if ($lot instanceof PartLot) {
$lot_id = $lot->getID();
@@ -230,7 +231,7 @@ final class ProjectBuildRequest
{
$this->ensureBOMEntryValid($projectBOMEntry);
- if (!$projectBOMEntry->getPart() instanceof \App\Entity\Parts\Part) {
+ if (!$projectBOMEntry->getPart() instanceof Part) {
return null;
}
diff --git a/src/Helpers/Trees/TreeViewNode.php b/src/Helpers/Trees/TreeViewNode.php
index 8fa328a3..0c5fcdce 100644
--- a/src/Helpers/Trees/TreeViewNode.php
+++ b/src/Helpers/Trees/TreeViewNode.php
@@ -151,7 +151,7 @@ final class TreeViewNode implements JsonSerializable
public function setDisabled(?bool $disabled): self
{
//Lazy loading of state, so it does not need to get serialized and transfered, when it is empty.
- if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) {
+ if (!$this->state instanceof TreeViewNodeState) {
$this->state = new TreeViewNodeState();
}
@@ -163,7 +163,7 @@ final class TreeViewNode implements JsonSerializable
public function setSelected(?bool $selected): self
{
//Lazy loading of state, so it does not need to get serialized and transfered, when it is empty.
- if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) {
+ if (!$this->state instanceof TreeViewNodeState) {
$this->state = new TreeViewNodeState();
}
@@ -175,7 +175,7 @@ final class TreeViewNode implements JsonSerializable
public function setExpanded(?bool $selected = true): self
{
//Lazy loading of state, so it does not need to get serialized and transfered, when it is empty.
- if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) {
+ if (!$this->state instanceof TreeViewNodeState) {
$this->state = new TreeViewNodeState();
}
@@ -232,7 +232,7 @@ final class TreeViewNode implements JsonSerializable
$ret['nodes'] = $this->nodes;
}
- if ($this->state instanceof \App\Helpers\Trees\TreeViewNodeState) {
+ if ($this->state instanceof TreeViewNodeState) {
$ret['state'] = $this->state;
}
diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php
index dbecfc2f..19143def 100644
--- a/src/Repository/StructuralDBElementRepository.php
+++ b/src/Repository/StructuralDBElementRepository.php
@@ -116,7 +116,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
$entity = $this->getNewEntityFromCache($name, $parent);
//See if we already have an element with this name and parent in the database
- if (!$entity instanceof \App\Entity\Base\AbstractStructuralDBElement) {
+ if (!$entity instanceof AbstractStructuralDBElement) {
$entity = $this->findOneBy(['name' => $name, 'parent' => $parent]);
}
if (null === $entity) {
@@ -138,7 +138,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
private function getNewEntityFromCache(string $name, ?AbstractStructuralDBElement $parent): ?AbstractStructuralDBElement
{
- $key = $parent instanceof \App\Entity\Base\AbstractStructuralDBElement ? $parent->getFullPath('%->%').'%->%'.$name : $name;
+ $key = $parent instanceof AbstractStructuralDBElement ? $parent->getFullPath('%->%').'%->%'.$name : $name;
if (isset($this->new_entity_cache[$key])) {
return $this->new_entity_cache[$key];
}
diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php
index 4cb51b64..62bf71f9 100644
--- a/src/Repository/UserRepository.php
+++ b/src/Repository/UserRepository.php
@@ -44,7 +44,7 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU
*/
public function getAnonymousUser(): ?User
{
- if (!$this->anonymous_user instanceof \App\Entity\UserSystem\User) {
+ if (!$this->anonymous_user instanceof User) {
$this->anonymous_user = $this->findOneBy([
'id' => User::ID_ANONYMOUS,
]);
diff --git a/src/Security/SamlUserFactory.php b/src/Security/SamlUserFactory.php
index 84704987..4bfefc88 100644
--- a/src/Security/SamlUserFactory.php
+++ b/src/Security/SamlUserFactory.php
@@ -98,7 +98,7 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf
//Check if we can find a group with the given ID
if ($group_id !== null) {
$group = $this->em->find(Group::class, $group_id);
- if ($group instanceof \App\Entity\UserSystem\Group) {
+ if ($group instanceof Group) {
return $group;
}
}
diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php
index 2f27d232..b482a1f3 100644
--- a/src/Security/Voter/AttachmentVoter.php
+++ b/src/Security/Voter/AttachmentVoter.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace App\Security\Voter;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentTypeAttachment;
use App\Entity\Attachments\CategoryAttachment;
@@ -39,13 +41,12 @@ use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
use RuntimeException;
-use Symfony\Component\Security\Core\Security;
use function in_array;
class AttachmentVoter extends ExtendedVoter
{
- public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security)
{
parent::__construct($resolver, $entityManager);
}
@@ -73,7 +74,7 @@ class AttachmentVoter extends ExtendedVoter
if (is_object($subject)) {
//If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element
$target_element = $subject->getElement();
- if ($target_element instanceof \App\Entity\Attachments\AttachmentContainingDBElement) {
+ if ($target_element instanceof AttachmentContainingDBElement) {
return $this->security->isGranted($this->mapOperation($attribute), $target_element);
}
}
diff --git a/src/Security/Voter/ExtendedVoter.php b/src/Security/Voter/ExtendedVoter.php
index 2474d02b..279944fc 100644
--- a/src/Security/Voter/ExtendedVoter.php
+++ b/src/Security/Voter/ExtendedVoter.php
@@ -52,7 +52,7 @@ abstract class ExtendedVoter extends Voter
/** @var UserRepository $repo */
$repo = $this->entityManager->getRepository(User::class);
$user = $repo->getAnonymousUser();
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
return false;
}
}
diff --git a/src/Security/Voter/LogEntryVoter.php b/src/Security/Voter/LogEntryVoter.php
index 0c9f86da..4ffecc5a 100644
--- a/src/Security/Voter/LogEntryVoter.php
+++ b/src/Security/Voter/LogEntryVoter.php
@@ -22,17 +22,17 @@ declare(strict_types=1);
namespace App\Security\Voter;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
-use Symfony\Component\Security\Core\Security;
class LogEntryVoter extends ExtendedVoter
{
final public const ALLOWED_OPS = ['read', 'show_details', 'delete'];
- public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, private readonly \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, private readonly Security $security)
{
parent::__construct($resolver, $entityManager);
}
diff --git a/src/Security/Voter/OrderdetailVoter.php b/src/Security/Voter/OrderdetailVoter.php
index f550807d..96ff609e 100644
--- a/src/Security/Voter/OrderdetailVoter.php
+++ b/src/Security/Voter/OrderdetailVoter.php
@@ -41,15 +41,16 @@ declare(strict_types=1);
namespace App\Security\Voter;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\Parts\Part;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
-use Symfony\Component\Security\Core\Security;
class OrderdetailVoter extends ExtendedVoter
{
- public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security)
{
parent::__construct($resolver, $entityManager);
}
@@ -71,7 +72,7 @@ class OrderdetailVoter extends ExtendedVoter
};
//If we have no part associated use the generic part permission
- if (is_string($subject) || !$subject->getPart() instanceof \App\Entity\Parts\Part) {
+ if (is_string($subject) || !$subject->getPart() instanceof Part) {
return $this->resolver->inherit($user, 'parts', $operation) ?? false;
}
diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php
index edc096a2..486decda 100644
--- a/src/Security/Voter/ParameterVoter.php
+++ b/src/Security/Voter/ParameterVoter.php
@@ -20,6 +20,8 @@
namespace App\Security\Voter;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\Base\AbstractDBElement;
use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parameters\AttachmentTypeParameter;
use App\Entity\Parameters\CategoryParameter;
@@ -36,12 +38,11 @@ use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
use RuntimeException;
-use Symfony\Component\Security\Core\Security;
class ParameterVoter extends ExtendedVoter
{
- public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security)
{
parent::__construct($resolver, $entityManager);
}
@@ -57,7 +58,7 @@ class ParameterVoter extends ExtendedVoter
if (is_object($subject)) {
//If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element
$target_element = $subject->getElement();
- if ($target_element instanceof \App\Entity\Base\AbstractDBElement) {
+ if ($target_element instanceof AbstractDBElement) {
$operation = match ($attribute) {
'read', 'view' => 'read',
'edit', 'create', 'delete' => 'edit',
diff --git a/src/Security/Voter/PartLotVoter.php b/src/Security/Voter/PartLotVoter.php
index 8293e234..fbdb5ad1 100644
--- a/src/Security/Voter/PartLotVoter.php
+++ b/src/Security/Voter/PartLotVoter.php
@@ -41,15 +41,16 @@ declare(strict_types=1);
namespace App\Security\Voter;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
-use Symfony\Component\Security\Core\Security;
class PartLotVoter extends ExtendedVoter
{
- public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security)
{
parent::__construct($resolver, $entityManager);
}
@@ -84,7 +85,7 @@ class PartLotVoter extends ExtendedVoter
};
//If we have no part associated use the generic part permission
- if (is_string($subject) || !$subject->getPart() instanceof \App\Entity\Parts\Part) {
+ if (is_string($subject) || !$subject->getPart() instanceof Part) {
return $this->resolver->inherit($user, 'parts', $operation) ?? false;
}
diff --git a/src/Security/Voter/PricedetailVoter.php b/src/Security/Voter/PricedetailVoter.php
index 98898ecf..c4def709 100644
--- a/src/Security/Voter/PricedetailVoter.php
+++ b/src/Security/Voter/PricedetailVoter.php
@@ -41,15 +41,17 @@ declare(strict_types=1);
namespace App\Security\Voter;
+use Symfony\Bundle\SecurityBundle\Security;
+use App\Entity\PriceInformations\Orderdetail;
+use App\Entity\Parts\Part;
use App\Entity\PriceInformations\Pricedetail;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
-use Symfony\Component\Security\Core\Security;
class PricedetailVoter extends ExtendedVoter
{
- public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security)
{
parent::__construct($resolver, $entityManager);
}
@@ -71,7 +73,7 @@ class PricedetailVoter extends ExtendedVoter
};
//If we have no part associated use the generic part permission
- if (is_string($subject) || !$subject->getOrderdetail() instanceof \App\Entity\PriceInformations\Orderdetail || !$subject->getOrderdetail()->getPart() instanceof \App\Entity\Parts\Part) {
+ if (is_string($subject) || !$subject->getOrderdetail() instanceof Orderdetail || !$subject->getOrderdetail()->getPart() instanceof Part) {
return $this->resolver->inherit($user, 'parts', $operation) ?? false;
}
diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php
index e7b90744..8de72fde 100644
--- a/src/Serializer/StructuralElementDenormalizer.php
+++ b/src/Serializer/StructuralElementDenormalizer.php
@@ -24,11 +24,10 @@ use App\Entity\Base\AbstractStructuralDBElement;
use App\Repository\StructuralDBElementRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
-use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
-class StructuralElementDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, CacheableSupportsMethodInterface
+class StructuralElementDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface
{
private array $object_cache = [];
diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php
index c85470d8..1266ae27 100644
--- a/src/Services/Attachments/AttachmentSubmitHandler.php
+++ b/src/Services/Attachments/AttachmentSubmitHandler.php
@@ -148,7 +148,7 @@ class AttachmentSubmitHandler
throw new InvalidArgumentException('The given attachment class is not known! The passed class was: '.$attachment::class);
}
//Ensure the attachment has an assigned element
- if (!$attachment->getElement() instanceof \App\Entity\Attachments\AttachmentContainingDBElement) {
+ if (!$attachment->getElement() instanceof AttachmentContainingDBElement) {
throw new InvalidArgumentException('The given attachment is not assigned to an element! An element is needed to generate a path!');
}
@@ -176,7 +176,7 @@ class AttachmentSubmitHandler
$options = $resolver->resolve($options);
//When a file is given then upload it, otherwise check if we need to download the URL
- if ($file instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) {
+ if ($file instanceof UploadedFile) {
$this->upload($attachment, $file, $options);
} elseif ($options['download_url'] && $attachment->isExternal()) {
$this->downloadURL($attachment, $options);
@@ -192,7 +192,7 @@ class AttachmentSubmitHandler
//this is only possible if the attachment is new (not yet persisted to DB)
if ($options['become_preview_if_empty'] && null === $attachment->getID() && $attachment->isPicture()) {
$element = $attachment->getElement();
- if ($element instanceof AttachmentContainingDBElement && !$element->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) {
+ if ($element instanceof AttachmentContainingDBElement && !$element->getMasterPictureAttachment() instanceof Attachment) {
$element->setMasterPictureAttachment($attachment);
}
}
diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php
index 7108cf12..c2a3b433 100644
--- a/src/Services/Attachments/AttachmentURLGenerator.php
+++ b/src/Services/Attachments/AttachmentURLGenerator.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Services\Attachments;
+use Imagine\Exception\RuntimeException;
use App\Entity\Attachments\Attachment;
use InvalidArgumentException;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
@@ -140,7 +141,7 @@ class AttachmentURLGenerator
$tmp = $this->thumbnailManager->getBrowserPath($asset_path, $filter_name, [], null, UrlGeneratorInterface::NETWORK_PATH);
//So we remove the schema manually
return preg_replace('/^https?:/', '', $tmp);
- } catch (\Imagine\Exception\RuntimeException $e) {
+ } catch (RuntimeException $e) {
//If the filter fails, we can not serve the thumbnail and fall back to the original image and log a warning
$this->logger->warning('Could not open thumbnail for attachment with ID ' . $attachment->getID() . ': ' . $e->getMessage());
return $this->assets->getUrl($asset_path);
diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php
index 5917e88b..a9273586 100644
--- a/src/Services/Attachments/PartPreviewGenerator.php
+++ b/src/Services/Attachments/PartPreviewGenerator.php
@@ -22,6 +22,12 @@ declare(strict_types=1);
namespace App\Services\Attachments;
+use App\Entity\Parts\Footprint;
+use App\Entity\ProjectSystem\Project;
+use App\Entity\Parts\Category;
+use App\Entity\Parts\Storelocation;
+use App\Entity\Parts\MeasurementUnit;
+use App\Entity\Parts\Manufacturer;
use App\Entity\Attachments\Attachment;
use App\Entity\Parts\Part;
@@ -52,21 +58,21 @@ class PartPreviewGenerator
$list[] = $attachment;
}
- if ($part->getFootprint() instanceof \App\Entity\Parts\Footprint) {
+ if ($part->getFootprint() instanceof Footprint) {
$attachment = $part->getFootprint()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
}
}
- if ($part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) {
+ if ($part->getBuiltProject() instanceof Project) {
$attachment = $part->getBuiltProject()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
}
}
- if ($part->getCategory() instanceof \App\Entity\Parts\Category) {
+ if ($part->getCategory() instanceof Category) {
$attachment = $part->getCategory()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
@@ -74,7 +80,7 @@ class PartPreviewGenerator
}
foreach ($part->getPartLots() as $lot) {
- if ($lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) {
+ if ($lot->getStorageLocation() instanceof Storelocation) {
$attachment = $lot->getStorageLocation()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
@@ -82,14 +88,14 @@ class PartPreviewGenerator
}
}
- if ($part->getPartUnit() instanceof \App\Entity\Parts\MeasurementUnit) {
+ if ($part->getPartUnit() instanceof MeasurementUnit) {
$attachment = $part->getPartUnit()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
}
}
- if ($part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer) {
+ if ($part->getManufacturer() instanceof Manufacturer) {
$attachment = $part->getManufacturer()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
@@ -114,7 +120,7 @@ class PartPreviewGenerator
}
//Otherwise check if the part has a footprint with a valid master attachment
- if ($part->getFootprint() instanceof \App\Entity\Parts\Footprint) {
+ if ($part->getFootprint() instanceof Footprint) {
$attachment = $part->getFootprint()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
return $attachment;
@@ -122,7 +128,7 @@ class PartPreviewGenerator
}
//With lowest priority use the master attachment of the project this part represents (when existing)
- if ($part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) {
+ if ($part->getBuiltProject() instanceof Project) {
$attachment = $part->getBuiltProject()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
return $attachment;
@@ -142,7 +148,7 @@ class PartPreviewGenerator
*/
protected function isAttachmentValidPicture(?Attachment $attachment): bool
{
- return $attachment instanceof \App\Entity\Attachments\Attachment
+ return $attachment instanceof Attachment
&& $attachment->isPicture()
&& $this->attachmentHelper->isFileExisting($attachment);
}
diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php
index b31ecf07..dc8c94a6 100644
--- a/src/Services/ElementTypeNameGenerator.php
+++ b/src/Services/ElementTypeNameGenerator.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Services;
+use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractDBElement;
@@ -162,17 +163,17 @@ class ElementTypeNameGenerator
//Add a hint to the associated element if possible
if ($include_associated) {
- if ($entity instanceof Attachment && $entity->getElement() instanceof \App\Entity\Attachments\AttachmentContainingDBElement) {
+ if ($entity instanceof Attachment && $entity->getElement() instanceof AttachmentContainingDBElement) {
$on = $entity->getElement();
- } elseif ($entity instanceof AbstractParameter && $entity->getElement() instanceof \App\Entity\Base\AbstractDBElement) {
+ } elseif ($entity instanceof AbstractParameter && $entity->getElement() instanceof AbstractDBElement) {
$on = $entity->getElement();
- } elseif ($entity instanceof PartLot && $entity->getPart() instanceof \App\Entity\Parts\Part) {
+ } elseif ($entity instanceof PartLot && $entity->getPart() instanceof Part) {
$on = $entity->getPart();
- } elseif ($entity instanceof Orderdetail && $entity->getPart() instanceof \App\Entity\Parts\Part) {
+ } elseif ($entity instanceof Orderdetail && $entity->getPart() instanceof Part) {
$on = $entity->getPart();
- } elseif ($entity instanceof Pricedetail && $entity->getOrderdetail() instanceof \App\Entity\PriceInformations\Orderdetail && $entity->getOrderdetail()->getPart() instanceof \App\Entity\Parts\Part) {
+ } elseif ($entity instanceof Pricedetail && $entity->getOrderdetail() instanceof Orderdetail && $entity->getOrderdetail()->getPart() instanceof Part) {
$on = $entity->getOrderdetail()->getPart();
- } elseif ($entity instanceof ProjectBOMEntry && $entity->getProject() instanceof \App\Entity\ProjectSystem\Project) {
+ } elseif ($entity instanceof ProjectBOMEntry && $entity->getProject() instanceof Project) {
$on = $entity->getProject();
}
diff --git a/src/Services/Formatters/MoneyFormatter.php b/src/Services/Formatters/MoneyFormatter.php
index 3e65e159..fbe4fc39 100644
--- a/src/Services/Formatters/MoneyFormatter.php
+++ b/src/Services/Formatters/MoneyFormatter.php
@@ -46,7 +46,7 @@ class MoneyFormatter
public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string
{
$iso_code = $this->base_currency;
- if ($currency instanceof \App\Entity\PriceInformations\Currency && !empty($currency->getIsoCode())) {
+ if ($currency instanceof Currency && !empty($currency->getIsoCode())) {
$iso_code = $currency->getIsoCode();
}
diff --git a/src/Services/ImportExportSystem/EntityExporter.php b/src/Services/ImportExportSystem/EntityExporter.php
index a4c3b48e..89b0e946 100644
--- a/src/Services/ImportExportSystem/EntityExporter.php
+++ b/src/Services/ImportExportSystem/EntityExporter.php
@@ -64,7 +64,7 @@ class EntityExporter
* @param array $options The options to use for exporting
* @return string The serialized data
*/
- public function exportEntities(\App\Entity\Base\AbstractNamedDBElement|array $entities, array $options): string
+ public function exportEntities(AbstractNamedDBElement|array $entities, array $options): string
{
if (!is_array($entities)) {
$entities = [$entities];
@@ -108,7 +108,7 @@ class EntityExporter
*
* @throws ReflectionException
*/
- public function exportEntityFromRequest(\App\Entity\Base\AbstractNamedDBElement|array $entities, Request $request): Response
+ public function exportEntityFromRequest(AbstractNamedDBElement|array $entities, Request $request): Response
{
$options = [
'format' => $request->get('format') ?? 'json',
diff --git a/src/Services/ImportExportSystem/EntityImporter.php b/src/Services/ImportExportSystem/EntityImporter.php
index 60014554..60d064f3 100644
--- a/src/Services/ImportExportSystem/EntityImporter.php
+++ b/src/Services/ImportExportSystem/EntityImporter.php
@@ -61,7 +61,7 @@ class EntityImporter
if (!is_a($class_name, AbstractNamedDBElement::class, true)) {
throw new InvalidArgumentException('$class_name must be a StructuralDBElement type!');
}
- if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement && !$parent instanceof $class_name) {
+ if ($parent instanceof AbstractStructuralDBElement && !$parent instanceof $class_name) {
throw new InvalidArgumentException('$parent must have the same type as specified in $class_name!');
}
@@ -85,11 +85,7 @@ class EntityImporter
}
while ($identSize < end($indentations)) {
//If the line is intendet less than the last line, we have to go up in the tree
- if ($current_parent instanceof AbstractStructuralDBElement) {
- $current_parent = $current_parent->getParent();
- } else {
- $current_parent = null;
- }
+ $current_parent = $current_parent instanceof AbstractStructuralDBElement ? $current_parent->getParent() : null;
array_pop($indentations);
}
diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php
index 76326ebd..54ecae63 100644
--- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php
+++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php
@@ -20,6 +20,7 @@
namespace App\Services\ImportExportSystem\PartKeeprImporter;
+use Doctrine\ORM\Id\AssignedGenerator;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\AttachmentType;
@@ -210,7 +211,7 @@ trait PKImportHelperTrait
$metadata = $this->em->getClassMetadata($element::class);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
- $metadata->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());
+ $metadata->setIdGenerator(new AssignedGenerator());
$metadata->setIdentifierValues($element, ['id' => $id]);
}
diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php
index 3690ccbc..c3d1f31e 100644
--- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php
+++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php
@@ -143,7 +143,7 @@ class PKPartImporter
throw new \RuntimeException(sprintf('Could not find part with ID %s', $partmanufacturer['part_id']));
}
$manufacturer = $this->em->find(Manufacturer::class, (int) $partmanufacturer['manufacturer_id']);
- if (!$manufacturer instanceof \App\Entity\Parts\Manufacturer) {
+ if (!$manufacturer instanceof Manufacturer) {
throw new \RuntimeException(sprintf('Could not find manufacturer with ID %s', $partmanufacturer['manufacturer_id']));
}
$part->setManufacturer($manufacturer);
@@ -187,7 +187,7 @@ class PKPartImporter
}
$part = $this->em->find(Part::class, (int) $partparameter['part_id']);
- if (!$part instanceof \App\Entity\Parts\Part) {
+ if (!$part instanceof Part) {
throw new \RuntimeException(sprintf('Could not find part with ID %s', $partparameter['part_id']));
}
@@ -235,12 +235,12 @@ class PKPartImporter
foreach ($data['partdistributor'] as $partdistributor) {
//Retrieve the part
$part = $this->em->find(Part::class, (int) $partdistributor['part_id']);
- if (!$part instanceof \App\Entity\Parts\Part) {
+ if (!$part instanceof Part) {
throw new \RuntimeException(sprintf('Could not find part with ID %s', $partdistributor['part_id']));
}
//Retrieve the distributor
$supplier = $this->em->find(Supplier::class, (int) $partdistributor['distributor_id']);
- if (!$supplier instanceof \App\Entity\Parts\Supplier) {
+ if (!$supplier instanceof Supplier) {
throw new \RuntimeException(sprintf('Could not find supplier with ID %s', $partdistributor['distributor_id']));
}
diff --git a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php
index f9b289b3..ba425483 100644
--- a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php
+++ b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php
@@ -71,7 +71,7 @@ final class BarcodeRedirector
case 'lot':
//Try to determine the part to the given lot
$lot = $this->em->find(PartLot::class, $id);
- if (!$lot instanceof \App\Entity\Parts\PartLot) {
+ if (!$lot instanceof PartLot) {
throw new EntityNotFoundException();
}
diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php
index 6fd28aef..98c3423a 100644
--- a/src/Services/LabelSystem/LabelHTMLGenerator.php
+++ b/src/Services/LabelSystem/LabelHTMLGenerator.php
@@ -41,18 +41,18 @@ declare(strict_types=1);
namespace App\Services\LabelSystem;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Contracts\NamedElementInterface;
use App\Entity\LabelSystem\LabelOptions;
use App\Exceptions\TwigModeException;
use App\Services\ElementTypeNameGenerator;
use InvalidArgumentException;
-use Symfony\Component\Security\Core\Security;
use Twig\Environment;
use Twig\Error\Error;
final class LabelHTMLGenerator
{
- public function __construct(private readonly ElementTypeNameGenerator $elementTypeNameGenerator, private readonly LabelTextReplacer $replacer, private readonly Environment $twig, private readonly BarcodeGenerator $barcodeGenerator, private readonly SandboxedTwigProvider $sandboxedTwigProvider, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly string $partdb_title)
+ public function __construct(private readonly ElementTypeNameGenerator $elementTypeNameGenerator, private readonly LabelTextReplacer $replacer, private readonly Environment $twig, private readonly BarcodeGenerator $barcodeGenerator, private readonly SandboxedTwigProvider $sandboxedTwigProvider, private readonly Security $security, private readonly string $partdb_title)
{
}
diff --git a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php
index 50efd563..1678bda1 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php
@@ -41,19 +41,19 @@ declare(strict_types=1);
namespace App\Services\LabelSystem\PlaceholderProviders;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\UserSystem\User;
use DateTime;
use IntlDateFormatter;
use Locale;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Security\Core\Security;
/**
* Provides Placeholders for infos about global infos like Installation name or datetimes.
*/
final class GlobalProviders implements PlaceholderProviderInterface
{
- public function __construct(private readonly string $partdb_title, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $url_generator)
+ public function __construct(private readonly string $partdb_title, private readonly Security $security, private readonly UrlGeneratorInterface $url_generator)
{
}
diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php
index ce071e9f..f7ff0b45 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php
@@ -41,6 +41,8 @@ declare(strict_types=1);
namespace App\Services\LabelSystem\PlaceholderProviders;
+use App\Entity\Parts\Storelocation;
+use App\Entity\UserSystem\User;
use App\Entity\Parts\PartLot;
use App\Services\Formatters\AmountFormatter;
use App\Services\LabelSystem\LabelTextReplacer;
@@ -90,19 +92,19 @@ final class PartLotProvider implements PlaceholderProviderInterface
}
if ('[[LOCATION]]' === $placeholder) {
- return $label_target->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $label_target->getStorageLocation()->getName() : '';
+ return $label_target->getStorageLocation() instanceof Storelocation ? $label_target->getStorageLocation()->getName() : '';
}
if ('[[LOCATION_FULL]]' === $placeholder) {
- return $label_target->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $label_target->getStorageLocation()->getFullPath() : '';
+ return $label_target->getStorageLocation() instanceof Storelocation ? $label_target->getStorageLocation()->getFullPath() : '';
}
if ('[[OWNER]]' === $placeholder) {
- return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getFullName() : '';
+ return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getFullName() : '';
}
if ('[[OWNER_USERNAME]]' === $placeholder) {
- return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getUsername() : '';
+ return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getUsername() : '';
}
return $this->labelTextReplacer->handlePlaceholder($placeholder, $label_target->getPart());
diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php
index d794b855..dbbe6263 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php
@@ -41,6 +41,9 @@ declare(strict_types=1);
namespace App\Services\LabelSystem\PlaceholderProviders;
+use App\Entity\Parts\Category;
+use App\Entity\Parts\Manufacturer;
+use App\Entity\Parts\Footprint;
use App\Entity\Parts\Part;
use App\Services\Formatters\SIFormatter;
use Parsedown;
@@ -59,27 +62,27 @@ final class PartProvider implements PlaceholderProviderInterface
}
if ('[[CATEGORY]]' === $placeholder) {
- return $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : '';
+ return $part->getCategory() instanceof Category ? $part->getCategory()->getName() : '';
}
if ('[[CATEGORY_FULL]]' === $placeholder) {
- return $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getFullPath() : '';
+ return $part->getCategory() instanceof Category ? $part->getCategory()->getFullPath() : '';
}
if ('[[MANUFACTURER]]' === $placeholder) {
- return $part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer ? $part->getManufacturer()->getName() : '';
+ return $part->getManufacturer() instanceof Manufacturer ? $part->getManufacturer()->getName() : '';
}
if ('[[MANUFACTURER_FULL]]' === $placeholder) {
- return $part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer ? $part->getManufacturer()->getFullPath() : '';
+ return $part->getManufacturer() instanceof Manufacturer ? $part->getManufacturer()->getFullPath() : '';
}
if ('[[FOOTPRINT]]' === $placeholder) {
- return $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '';
+ return $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getName() : '';
}
if ('[[FOOTPRINT_FULL]]' === $placeholder) {
- return $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getFullPath() : '';
+ return $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getFullPath() : '';
}
if ('[[MASS]]' === $placeholder) {
diff --git a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php
index 85c1d13a..18a4c7d2 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php
@@ -20,6 +20,7 @@
namespace App\Services\LabelSystem\PlaceholderProviders;
+use App\Entity\UserSystem\User;
use App\Entity\Parts\Storelocation;
class StorelocationProvider implements PlaceholderProviderInterface
@@ -28,11 +29,11 @@ class StorelocationProvider implements PlaceholderProviderInterface
{
if ($label_target instanceof Storelocation) {
if ('[[OWNER]]' === $placeholder) {
- return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getFullName() : '';
+ return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getFullName() : '';
}
if ('[[OWNER_USERNAME]]' === $placeholder) {
- return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getUsername() : '';
+ return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getUsername() : '';
}
}
diff --git a/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php
index 31d7618e..ca8088da 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php
@@ -58,10 +58,10 @@ final class StructuralDBElementProvider implements PlaceholderProviderInterface
return $label_target->getFullPath();
}
if ('[[PARENT]]' === $placeholder) {
- return $label_target->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $label_target->getParent()->getName() : '';
+ return $label_target->getParent() instanceof AbstractStructuralDBElement ? $label_target->getParent()->getName() : '';
}
if ('[[PARENT_FULL_PATH]]' === $placeholder) {
- return $label_target->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $label_target->getParent()->getFullPath() : '';
+ return $label_target->getParent() instanceof AbstractStructuralDBElement ? $label_target->getParent()->getFullPath() : '';
}
}
diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php
index afc1c69b..82e2df3a 100644
--- a/src/Services/LogSystem/EventLogger.php
+++ b/src/Services/LogSystem/EventLogger.php
@@ -22,15 +22,16 @@ declare(strict_types=1);
namespace App\Services\LogSystem;
+use Symfony\Bundle\SecurityBundle\Security;
+use Symfony\Component\Security\Core\User\UserInterface;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\UserSystem\User;
use App\Services\Misc\ConsoleInfoHelper;
use Doctrine\ORM\EntityManagerInterface;
-use Symfony\Component\Security\Core\Security;
class EventLogger
{
- public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected \Symfony\Bundle\SecurityBundle\Security $security, protected ConsoleInfoHelper $console_info_helper)
+ public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected Security $security, protected ConsoleInfoHelper $console_info_helper)
{
}
@@ -44,14 +45,14 @@ class EventLogger
{
$user = $this->security->getUser();
//If the user is not specified explicitly, set it to the current user
- if ((!$user instanceof \Symfony\Component\Security\Core\User\UserInterface || $user instanceof User) && !$logEntry->getUser() instanceof \App\Entity\UserSystem\User) {
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if ((!$user instanceof UserInterface || $user instanceof User) && !$logEntry->getUser() instanceof User) {
+ if (!$user instanceof User) {
$repo = $this->em->getRepository(User::class);
$user = $repo->getAnonymousUser();
}
//If no anonymous user is available skip the log (needed for data fixtures)
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
return false;
}
$logEntry->setUser($user);
diff --git a/src/Services/LogSystem/LogTargetHelper.php b/src/Services/LogSystem/LogTargetHelper.php
index e8ea4a6b..abd57674 100644
--- a/src/Services/LogSystem/LogTargetHelper.php
+++ b/src/Services/LogSystem/LogTargetHelper.php
@@ -70,7 +70,7 @@ class LogTargetHelper
$target = $this->entryRepository->getTargetElement($context);
//If the target is null and the context has a target, that means that the target was deleted. Show it that way.
- if (!$target instanceof \App\Entity\Base\AbstractDBElement) {
+ if (!$target instanceof AbstractDBElement) {
if ($context->hasTarget()) {
return $this->elementTypeNameGenerator->formatElementDeletedHTML($context->getTargetClass(),
$context->getTargetId());
diff --git a/src/Services/Misc/DBInfoHelper.php b/src/Services/Misc/DBInfoHelper.php
index 3d5c27a7..f2c638ff 100644
--- a/src/Services/Misc/DBInfoHelper.php
+++ b/src/Services/Misc/DBInfoHelper.php
@@ -20,6 +20,7 @@
namespace App\Services\Misc;
+use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
@@ -56,7 +57,7 @@ class DBInfoHelper
/**
* Returns the database version of the used database.
- * @throws \Doctrine\DBAL\Exception
+ * @throws Exception
*/
public function getDatabaseVersion(): ?string
{
@@ -74,14 +75,14 @@ class DBInfoHelper
/**
* Returns the database size in bytes.
* @return int|null The database size in bytes or null if unknown
- * @throws \Doctrine\DBAL\Exception
+ * @throws Exception
*/
public function getDatabaseSize(): ?int
{
if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
try {
return $this->connection->fetchOne('SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema = DATABASE()');
- } catch (\Doctrine\DBAL\Exception) {
+ } catch (Exception) {
return null;
}
}
@@ -89,7 +90,7 @@ class DBInfoHelper
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
try {
return $this->connection->fetchOne('SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size();');
- } catch (\Doctrine\DBAL\Exception) {
+ } catch (Exception) {
return null;
}
}
@@ -113,7 +114,7 @@ class DBInfoHelper
if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
try {
return $this->connection->fetchOne('SELECT USER()');
- } catch (\Doctrine\DBAL\Exception) {
+ } catch (Exception) {
return null;
}
}
diff --git a/src/Services/Parameters/ParameterExtractor.php b/src/Services/Parameters/ParameterExtractor.php
index c1151970..3257d96d 100644
--- a/src/Services/Parameters/ParameterExtractor.php
+++ b/src/Services/Parameters/ParameterExtractor.php
@@ -74,7 +74,7 @@ class ParameterExtractor
$split = $this->splitString($input);
foreach ($split as $param_string) {
$tmp = $this->stringToParam($param_string, $class);
- if ($tmp instanceof \App\Entity\Parameters\AbstractParameter) {
+ if ($tmp instanceof AbstractParameter) {
$parameters[] = $tmp;
}
}
diff --git a/src/Services/Parts/PartLotWithdrawAddHelper.php b/src/Services/Parts/PartLotWithdrawAddHelper.php
index f63ae15f..9ffbbbe9 100644
--- a/src/Services/Parts/PartLotWithdrawAddHelper.php
+++ b/src/Services/Parts/PartLotWithdrawAddHelper.php
@@ -2,6 +2,7 @@
namespace App\Services\Parts;
+use App\Entity\Parts\Storelocation;
use App\Entity\LogSystem\PartStockChangedLogEntry;
use App\Entity\Parts\PartLot;
use App\Services\LogSystem\EventCommentHelper;
@@ -24,7 +25,7 @@ final class PartLotWithdrawAddHelper
}
//So far all other restrictions are defined at the storelocation level
- if(!$partLot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) {
+ if(!$partLot->getStorageLocation() instanceof Storelocation) {
return true;
}
//We can not add parts if the storage location of the lot is marked as full
diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php
index d5e1f8a1..d4af56ae 100644
--- a/src/Services/Parts/PartsTableActionHandler.php
+++ b/src/Services/Parts/PartsTableActionHandler.php
@@ -20,6 +20,7 @@
namespace App\Services\Parts;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
@@ -33,11 +34,10 @@ use InvalidArgumentException;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
-use Symfony\Component\Security\Core\Security;
final class PartsTableActionHandler
{
- public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator)
+ public function __construct(private readonly EntityManagerInterface $entityManager, private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator)
{
}
diff --git a/src/Services/Parts/PricedetailHelper.php b/src/Services/Parts/PricedetailHelper.php
index 14c914d4..d989593d 100644
--- a/src/Services/Parts/PricedetailHelper.php
+++ b/src/Services/Parts/PricedetailHelper.php
@@ -150,13 +150,13 @@ class PricedetailHelper
$pricedetail = $orderdetail->findPriceForQty($amount);
//When we don't have information about this amount, ignore it
- if (!$pricedetail instanceof \App\Entity\PriceInformations\Pricedetail) {
+ if (!$pricedetail instanceof Pricedetail) {
continue;
}
$converted = $this->convertMoneyToCurrency($pricedetail->getPricePerUnit(), $pricedetail->getCurrency(), $currency);
//Ignore price information that can not be converted to base currency.
- if ($converted instanceof \Brick\Math\BigDecimal) {
+ if ($converted instanceof BigDecimal) {
$avg = $avg->plus($converted);
++$count;
}
@@ -189,9 +189,9 @@ class PricedetailHelper
$val_base = $value;
//Convert value to base currency
- if ($originCurrency instanceof \App\Entity\PriceInformations\Currency) {
+ if ($originCurrency instanceof Currency) {
//Without an exchange rate we can not calculate the exchange rate
- if (!$originCurrency->getExchangeRate() instanceof \Brick\Math\BigDecimal || $originCurrency->getExchangeRate()->isZero()) {
+ if (!$originCurrency->getExchangeRate() instanceof BigDecimal || $originCurrency->getExchangeRate()->isZero()) {
return null;
}
@@ -200,9 +200,9 @@ class PricedetailHelper
$val_target = $val_base;
//Convert value in base currency to target currency
- if ($targetCurrency instanceof \App\Entity\PriceInformations\Currency) {
+ if ($targetCurrency instanceof Currency) {
//Without an exchange rate we can not calculate the exchange rate
- if (!$targetCurrency->getExchangeRate() instanceof \Brick\Math\BigDecimal) {
+ if (!$targetCurrency->getExchangeRate() instanceof BigDecimal) {
return null;
}
diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php
index 30f31c33..1ca2d0e8 100644
--- a/src/Services/ProjectSystem/ProjectBuildHelper.php
+++ b/src/Services/ProjectSystem/ProjectBuildHelper.php
@@ -20,6 +20,7 @@
namespace App\Services\ProjectSystem;
+use App\Entity\Parts\Part;
use App\Entity\ProjectSystem\Project;
use App\Entity\ProjectSystem\ProjectBOMEntry;
use App\Helpers\Projects\ProjectBuildRequest;
@@ -39,7 +40,7 @@ class ProjectBuildHelper
{
$part = $projectBOMEntry->getPart();
- if (!$part instanceof \App\Entity\Parts\Part) {
+ if (!$part instanceof Part) {
throw new \InvalidArgumentException('This function cannot determine the maximum buildable count for a BOM entry without a part!');
}
@@ -108,7 +109,7 @@ class ProjectBuildHelper
$part = $bomEntry->getPart();
//Skip BOM entries without a part (as we can not determine that)
- if (!$part instanceof \App\Entity\Parts\Part) {
+ if (!$part instanceof Part) {
continue;
}
diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php
index 30b868d3..0196b215 100644
--- a/src/Services/Trees/NodesListBuilder.php
+++ b/src/Services/Trees/NodesListBuilder.php
@@ -49,7 +49,7 @@ class NodesListBuilder
*/
public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array
{
- $parent_id = $parent instanceof \App\Entity\Base\AbstractStructuralDBElement ? $parent->getID() : '0';
+ $parent_id = $parent instanceof AbstractStructuralDBElement ? $parent->getID() : '0';
// Backslashes are not allowed in cache keys
$secure_class_name = str_replace('\\', '_', $class_name);
$key = 'list_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.$parent_id;
diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php
index 37c84642..201c5fd3 100644
--- a/src/Services/Trees/ToolsTreeBuilder.php
+++ b/src/Services/Trees/ToolsTreeBuilder.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Services\Trees;
+use Symfony\Bundle\SecurityBundle\Security;
use App\Entity\Attachments\AttachmentType;
use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile;
@@ -38,7 +39,6 @@ use App\Entity\UserSystem\User;
use App\Helpers\Trees\TreeViewNode;
use App\Services\UserSystem\UserCacheKeyGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -49,7 +49,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class ToolsTreeBuilder
{
- public function __construct(protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected \Symfony\Bundle\SecurityBundle\Security $security)
+ public function __construct(protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected Security $security)
{
}
diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php
index 61f32922..1ee0647b 100644
--- a/src/Services/Trees/TreeViewGenerator.php
+++ b/src/Services/Trees/TreeViewGenerator.php
@@ -74,7 +74,7 @@ class TreeViewGenerator
$href = $this->urlGenerator->createURL(new $class());
$new_node = new TreeViewNode($this->translator->trans('entity.tree.new'), $href);
//When the id of the selected element is null, then we have a new element, and we need to select "new" node
- if (!$selectedElement instanceof \App\Entity\Base\AbstractDBElement || null === $selectedElement->getID()) {
+ if (!$selectedElement instanceof AbstractDBElement || null === $selectedElement->getID()) {
$new_node->setSelected(true);
}
$head[] = $new_node;
@@ -98,7 +98,7 @@ class TreeViewGenerator
$recursiveIterator = new RecursiveIteratorIterator($treeIterator, RecursiveIteratorIterator::SELF_FIRST);
foreach ($recursiveIterator as $item) {
/** @var TreeViewNode $item */
- if ($selectedElement instanceof \App\Entity\Base\AbstractDBElement && $item->getId() === $selectedElement->getID()) {
+ if ($selectedElement instanceof AbstractDBElement && $item->getId() === $selectedElement->getID()) {
$item->setSelected(true);
}
@@ -184,7 +184,7 @@ class TreeViewGenerator
if (!is_a($class, AbstractNamedDBElement::class, true)) {
throw new InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!');
}
- if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement && !$parent instanceof $class) {
+ if ($parent instanceof AbstractStructuralDBElement && !$parent instanceof $class) {
throw new InvalidArgumentException('$parent must be of the type $class!');
}
@@ -192,7 +192,7 @@ class TreeViewGenerator
$repo = $this->em->getRepository($class);
//If we just want a part of a tree, don't cache it
- if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) {
+ if ($parent instanceof AbstractStructuralDBElement) {
return $repo->getGenericNodeTree($parent);
}
diff --git a/src/Services/UserSystem/PasswordResetManager.php b/src/Services/UserSystem/PasswordResetManager.php
index 2a4c9274..d479fb51 100644
--- a/src/Services/UserSystem/PasswordResetManager.php
+++ b/src/Services/UserSystem/PasswordResetManager.php
@@ -51,7 +51,7 @@ class PasswordResetManager
//Try to find a user by the given string
$user = $repo->findByEmailOrName($name_or_email);
//Do nothing if no user was found
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
return;
}
@@ -101,7 +101,7 @@ class PasswordResetManager
$user = $repo->findOneBy(['name' => $username]);
//If no user matching the name, show an error message
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
return false;
}
diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php
index cf3e1455..ae3764d8 100644
--- a/src/Services/UserSystem/PermissionManager.php
+++ b/src/Services/UserSystem/PermissionManager.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Services\UserSystem;
+use App\Entity\Base\AbstractStructuralDBElement;
use App\Configuration\PermissionsConfiguration;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
@@ -110,7 +111,7 @@ class PermissionManager
/** @var Group $parent */
$parent = $user->getGroup();
- while ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { //The top group, has parent == null
+ while ($parent instanceof AbstractStructuralDBElement) { //The top group, has parent == null
//Check if our current element gives an info about disallow/allow
$allowed = $this->dontInherit($parent, $permission, $operation);
if (null !== $allowed) {
diff --git a/src/Services/UserSystem/PermissionSchemaUpdater.php b/src/Services/UserSystem/PermissionSchemaUpdater.php
index 72231bcb..3c12d042 100644
--- a/src/Services/UserSystem/PermissionSchemaUpdater.php
+++ b/src/Services/UserSystem/PermissionSchemaUpdater.php
@@ -102,7 +102,7 @@ class PermissionSchemaUpdater
public function userUpgradeSchemaRecursively(User $user, int $target_version = PermissionData::CURRENT_SCHEMA_VERSION): bool
{
$updated = $this->upgradeSchema($user, $target_version);
- if ($user->getGroup() instanceof \App\Entity\UserSystem\Group) {
+ if ($user->getGroup() instanceof Group) {
$updated = $this->groupUpgradeSchemaRecursively($user->getGroup(), $target_version) || $updated;
}
diff --git a/src/Services/UserSystem/UserAvatarHelper.php b/src/Services/UserSystem/UserAvatarHelper.php
index 026cdcd5..73de40f7 100644
--- a/src/Services/UserSystem/UserAvatarHelper.php
+++ b/src/Services/UserSystem/UserAvatarHelper.php
@@ -20,6 +20,7 @@
namespace App\Services\UserSystem;
+use Imagine\Exception\RuntimeException;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\UserAttachment;
@@ -44,7 +45,7 @@ class UserAvatarHelper
public function getAvatarURL(User $user): string
{
//Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture)
- if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) {
+ if ($user->getMasterPictureAttachment() instanceof Attachment) {
return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_md');
}
@@ -60,7 +61,7 @@ class UserAvatarHelper
public function getAvatarSmURL(User $user): string
{
//Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture)
- if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) {
+ if ($user->getMasterPictureAttachment() instanceof Attachment) {
return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_xs');
}
@@ -72,7 +73,7 @@ class UserAvatarHelper
try {
//Otherwise we can serve the relative path via Asset component
return $this->filterService->getUrlOfFilteredImage('/img/default_avatar.png', 'thumbnail_xs');
- } catch (\Imagine\Exception\RuntimeException) {
+ } catch (RuntimeException) {
//If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning
return $this->packages->getUrl('/img/default_avatar.png');
}
@@ -81,7 +82,7 @@ class UserAvatarHelper
public function getAvatarMdURL(User $user): string
{
//Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture)
- if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) {
+ if ($user->getMasterPictureAttachment() instanceof Attachment) {
return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_sm');
}
@@ -93,7 +94,7 @@ class UserAvatarHelper
try {
//Otherwise we can serve the relative path via Asset component
return $this->filterService->getUrlOfFilteredImage('/img/default_avatar.png', 'thumbnail_xs');
- } catch (\Imagine\Exception\RuntimeException) {
+ } catch (RuntimeException) {
//If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning
return $this->packages->getUrl('/img/default_avatar.png');
}
@@ -131,7 +132,7 @@ class UserAvatarHelper
{
//Determine which attachment to user
//If the user already has a master attachment, we use this one
- if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) {
+ if ($user->getMasterPictureAttachment() instanceof Attachment) {
$attachment = $user->getMasterPictureAttachment();
} else { //Otherwise we have to create one
$attachment = new UserAttachment();
diff --git a/src/Services/UserSystem/UserCacheKeyGenerator.php b/src/Services/UserSystem/UserCacheKeyGenerator.php
index 69caeff3..f8aec6a1 100644
--- a/src/Services/UserSystem/UserCacheKeyGenerator.php
+++ b/src/Services/UserSystem/UserCacheKeyGenerator.php
@@ -22,17 +22,18 @@ declare(strict_types=1);
namespace App\Services\UserSystem;
+use Symfony\Bundle\SecurityBundle\Security;
+use Symfony\Component\HttpFoundation\Request;
use App\Entity\UserSystem\User;
use Locale;
use Symfony\Component\HttpFoundation\RequestStack;
-use Symfony\Component\Security\Core\Security;
/**
* Purpose of this service is to generate a key unique for a user, to use in Cache keys and tags.
*/
class UserCacheKeyGenerator
{
- public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected RequestStack $requestStack)
+ public function __construct(protected Security $security, protected RequestStack $requestStack)
{
}
@@ -46,10 +47,10 @@ class UserCacheKeyGenerator
{
$request = $this->requestStack->getCurrentRequest();
//Retrieve the locale from the request, if possible, otherwise use the default locale
- $locale = $request instanceof \Symfony\Component\HttpFoundation\Request ? $request->getLocale() : Locale::getDefault();
+ $locale = $request instanceof Request ? $request->getLocale() : Locale::getDefault();
//If no user was specified, use the currently used one.
- if (!$user instanceof \App\Entity\UserSystem\User) {
+ if (!$user instanceof User) {
$user = $this->security->getUser();
}
diff --git a/src/Twig/AttachmentExtension.php b/src/Twig/AttachmentExtension.php
index c0897ab2..beb1295c 100644
--- a/src/Twig/AttachmentExtension.php
+++ b/src/Twig/AttachmentExtension.php
@@ -20,6 +20,7 @@
namespace App\Twig;
+use App\Entity\Attachments\Attachment;
use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\Misc\FAIconGenerator;
use Twig\Extension\AbstractExtension;
@@ -35,7 +36,7 @@ final class AttachmentExtension extends AbstractExtension
{
return [
/* Returns the URL to a thumbnail of the given attachment */
- new TwigFunction('attachment_thumbnail', fn(\App\Entity\Attachments\Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)),
+ new TwigFunction('attachment_thumbnail', fn(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)),
/* Returns the font awesome icon class which is representing the given file extension */
new TwigFunction('ext_to_fa_icon', fn(string $extension): string => $this->FAIconGenerator->fileExtensionToFAType($extension)),
];
diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php
index 1a8f5d37..393c4040 100644
--- a/src/Twig/EntityExtension.php
+++ b/src/Twig/EntityExtension.php
@@ -62,11 +62,11 @@ final class EntityExtension extends AbstractExtension
/* Returns a string representation of the given entity */
new TwigFunction('entity_type', fn(object $entity): ?string => $this->getEntityType($entity)),
/* Returns the URL to the given entity */
- new TwigFunction('entity_url', fn(\App\Entity\Base\AbstractDBElement $entity, string $method = 'info'): string => $this->generateEntityURL($entity, $method)),
+ new TwigFunction('entity_url', fn(AbstractDBElement $entity, string $method = 'info'): string => $this->generateEntityURL($entity, $method)),
/* Returns the URL to the given entity in timetravel mode */
- new TwigFunction('timetravel_url', fn(\App\Entity\Base\AbstractDBElement $element, \DateTimeInterface $dateTime): ?string => $this->timeTravelURL($element, $dateTime)),
+ new TwigFunction('timetravel_url', fn(AbstractDBElement $element, \DateTimeInterface $dateTime): ?string => $this->timeTravelURL($element, $dateTime)),
/* Generates a JSON array of the given tree */
- new TwigFunction('tree_data', fn(\App\Entity\Base\AbstractDBElement $element, string $type = 'newEdit'): string => $this->treeData($element, $type)),
+ new TwigFunction('tree_data', fn(AbstractDBElement $element, string $type = 'newEdit'): string => $this->treeData($element, $type)),
/* Gets a human readable label for the type of the given entity */
new TwigFunction('entity_type_label', fn(object|string $entity): string => $this->nameGenerator->getLocalizedTypeLabel($entity)),
diff --git a/src/Twig/FormatExtension.php b/src/Twig/FormatExtension.php
index d5fe0e91..76628ccd 100644
--- a/src/Twig/FormatExtension.php
+++ b/src/Twig/FormatExtension.php
@@ -47,11 +47,11 @@ final class FormatExtension extends AbstractExtension
'is_safe' => ['html'],
]),
/* Format the given amount as money, using a given currency */
- new TwigFilter('format_money', fn($amount, ?\App\Entity\PriceInformations\Currency $currency = null, int $decimals = 5): string => $this->formatCurrency($amount, $currency, $decimals)),
+ new TwigFilter('format_money', fn($amount, ?Currency $currency = null, int $decimals = 5): string => $this->formatCurrency($amount, $currency, $decimals)),
/* Format the given number using SI prefixes and the given unit (string) */
new TwigFilter('format_si', fn($value, $unit, $decimals = 2, bool $show_all_digits = false): string => $this->siFormat($value, $unit, $decimals, $show_all_digits)),
/** Format the given amount using the given MeasurementUnit */
- new TwigFilter('format_amount', fn($value, ?\App\Entity\Parts\MeasurementUnit $unit, array $options = []): string => $this->amountFormat($value, $unit, $options)),
+ new TwigFilter('format_amount', fn($value, ?MeasurementUnit $unit, array $options = []): string => $this->amountFormat($value, $unit, $options)),
/** Format the given number of bytes as human-readable number */
new TwigFilter('format_bytes', fn(int $bytes, int $precision = 2): string => $this->formatBytes($bytes, $precision)),
];
diff --git a/src/Twig/LogExtension.php b/src/Twig/LogExtension.php
index c8edb106..8a0be446 100644
--- a/src/Twig/LogExtension.php
+++ b/src/Twig/LogExtension.php
@@ -20,6 +20,7 @@
namespace App\Twig;
+use App\Entity\LogSystem\AbstractLogEntry;
use App\Services\LogSystem\LogDataFormatter;
use App\Services\LogSystem\LogDiffFormatter;
use Twig\Extension\AbstractExtension;
@@ -35,7 +36,7 @@ final class LogExtension extends AbstractExtension
public function getFunctions()
{
return [
- new TwigFunction('format_log_data', fn($data, \App\Entity\LogSystem\AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]),
+ new TwigFunction('format_log_data', fn($data, AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]),
new TwigFunction('format_log_diff', fn($old_data, $new_data): string => $this->logDiffFormatter->formatDiff($old_data, $new_data), ['is_safe' => ['html']]),
];
}
diff --git a/src/Twig/MiscExtension.php b/src/Twig/MiscExtension.php
index 54e34d09..32080df2 100644
--- a/src/Twig/MiscExtension.php
+++ b/src/Twig/MiscExtension.php
@@ -20,6 +20,7 @@
namespace App\Twig;
+use Twig\TwigFunction;
use App\Services\LogSystem\EventCommentNeededHelper;
use Twig\Extension\AbstractExtension;
@@ -32,7 +33,7 @@ final class MiscExtension extends AbstractExtension
public function getFunctions(): array
{
return [
- new \Twig\TwigFunction('event_comment_needed',
+ new TwigFunction('event_comment_needed',
fn(string $operation_type) => $this->eventCommentNeededHelper->isCommentNeeded($operation_type)
),
];
diff --git a/src/Twig/UserExtension.php b/src/Twig/UserExtension.php
index d2c8880f..012f975c 100644
--- a/src/Twig/UserExtension.php
+++ b/src/Twig/UserExtension.php
@@ -41,6 +41,8 @@ declare(strict_types=1);
namespace App\Twig;
+use App\Entity\Base\AbstractDBElement;
+use App\Entity\UserSystem\User;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Repository\LogEntryRepository;
use Doctrine\ORM\EntityManagerInterface;
@@ -68,9 +70,9 @@ final class UserExtension extends AbstractExtension
{
return [
/* Returns the user which has edited the given entity the last time. */
- new TwigFunction('last_editing_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getLastEditingUser($element)),
+ new TwigFunction('last_editing_user', fn(AbstractDBElement $element): ?User => $this->repo->getLastEditingUser($element)),
/* Returns the user which has created the given entity. */
- new TwigFunction('creating_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getCreatingUser($element)),
+ new TwigFunction('creating_user', fn(AbstractDBElement $element): ?User => $this->repo->getCreatingUser($element)),
];
}
diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php
index 0cf60f59..7d7a3588 100644
--- a/src/Validator/Constraints/NoLockoutValidator.php
+++ b/src/Validator/Constraints/NoLockoutValidator.php
@@ -22,12 +22,13 @@ declare(strict_types=1);
namespace App\Validator\Constraints;
+use Symfony\Bundle\SecurityBundle\Security;
+use Symfony\Component\Security\Core\User\UserInterface;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
-use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
@@ -35,7 +36,7 @@ class NoLockoutValidator extends ConstraintValidator
{
protected array $perm_structure;
- public function __construct(protected PermissionManager $resolver, protected \Symfony\Bundle\SecurityBundle\Security $security, protected EntityManagerInterface $entityManager)
+ public function __construct(protected PermissionManager $resolver, protected Security $security, protected EntityManagerInterface $entityManager)
{
$this->perm_structure = $resolver->getPermissionStructure();
}
@@ -58,7 +59,7 @@ class NoLockoutValidator extends ConstraintValidator
if ($perm_holder instanceof User || $perm_holder instanceof Group) {
$user = $this->security->getUser();
- if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
+ if (!$user instanceof UserInterface) {
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
}
diff --git a/src/Validator/Constraints/ValidPartLotValidator.php b/src/Validator/Constraints/ValidPartLotValidator.php
index 5e5b22d9..4f988362 100644
--- a/src/Validator/Constraints/ValidPartLotValidator.php
+++ b/src/Validator/Constraints/ValidPartLotValidator.php
@@ -53,7 +53,7 @@ class ValidPartLotValidator extends ConstraintValidator
}
//We can only validate the values if we know the storelocation
- if ($value->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) {
+ if ($value->getStorageLocation() instanceof Storelocation) {
$repo = $this->em->getRepository(Storelocation::class);
//We can only determine associated parts, if the part have an ID
//When the storage location is new (no ID), we can just assume there are no other parts
diff --git a/tests/Controller/RedirectControllerTest.php b/tests/Controller/RedirectControllerTest.php
index 90fa63b1..d7df73cc 100644
--- a/tests/Controller/RedirectControllerTest.php
+++ b/tests/Controller/RedirectControllerTest.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Tests\Controller;
+use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use App\Entity\UserSystem\User;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManagerInterface;
@@ -35,7 +36,7 @@ class RedirectControllerTest extends WebTestCase
{
protected EntityManagerInterface $em;
protected UserRepository $userRepo;
- protected \Symfony\Bundle\FrameworkBundle\KernelBrowser $client;
+ protected KernelBrowser $client;
protected function setUp(): void
{
diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php
index 25446697..8cc8dc2b 100644
--- a/tests/Helpers/Projects/ProjectBuildRequestTest.php
+++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php
@@ -43,8 +43,8 @@ class ProjectBuildRequestTest extends TestCase
/** @var ProjectBOMEntry */
private ProjectBOMEntry $bom_entry1c;
- private \App\Entity\Parts\PartLot $lot1a;
- private \App\Entity\Parts\PartLot $lot1b;
+ private PartLot $lot1a;
+ private PartLot $lot1b;
private PartLot $lot2;
/** @var Part */
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php
index 8e2b784e..51584edc 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php
@@ -41,6 +41,7 @@ declare(strict_types=1);
namespace App\Tests\Services\LabelSystem\PlaceholderProviders;
+use Doctrine\ORM\EntityManager;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Part;
@@ -61,7 +62,7 @@ class PartProviderTest extends WebTestCase
protected Part $target;
/**
- * @var \Doctrine\ORM\EntityManager
+ * @var EntityManager
*/
protected $em;