diff --git a/src/Command/Attachments/CleanAttachmentsCommand.php b/src/Command/Attachments/CleanAttachmentsCommand.php index 40f568bf..6004a3eb 100644 --- a/src/Command/Attachments/CleanAttachmentsCommand.php +++ b/src/Command/Attachments/CleanAttachmentsCommand.php @@ -40,9 +40,10 @@ 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).')] class CleanAttachmentsCommand extends Command { - protected static $defaultName = 'partdb:attachments:clean-unused|app:clean-attachments'; + protected static $defaultDescription = 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).'; protected AttachmentManager $attachment_helper; protected AttachmentReverseSearch $reverseSearch; @@ -60,10 +61,8 @@ class CleanAttachmentsCommand extends Command protected function configure(): void { - $this - ->setDescription('Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).') - ->setHelp('This command allows to find all files in the media folder which are not associated with an attachment anymore.'. - ' These files are not needed and can eventually deleted.'); + $this->setHelp('This command allows to find all files in the media folder which are not associated with an attachment anymore.'. + ' These files are not needed and can eventually deleted.'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -108,7 +107,7 @@ class CleanAttachmentsCommand extends Command if (!$continue) { //We are finished here, when no files should be deleted - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } //Delete the files @@ -121,7 +120,7 @@ class CleanAttachmentsCommand extends Command $io->success('No abandoned files found.'); } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } /** diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php index d12add92..dc248126 100644 --- a/src/Command/BackupCommand.php +++ b/src/Command/BackupCommand.php @@ -16,11 +16,9 @@ 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')] class BackupCommand extends Command { - protected static $defaultName = 'partdb:backup'; - protected static $defaultDescription = 'Backup the files and the database of Part-DB'; - private string $project_dir; private EntityManagerInterface $entityManager; diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 60883f81..8bc4c62d 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -27,9 +27,10 @@ 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.')] class CheckRequirementsCommand extends Command { - protected static $defaultName = 'partdb:check-requirements'; + protected static $defaultDescription = 'Checks if the requirements Part-DB needs or recommends are fulfilled.'; protected ContainerBagInterface $params; @@ -41,9 +42,7 @@ class CheckRequirementsCommand extends Command protected function configure(): void { - $this - ->setDescription('Checks if the requirements Part-DB needs or recommends are fulfilled.') - ->addOption('only_issues', 'i', InputOption::VALUE_NONE, 'Only show issues, not success messages.') + $this->addOption('only_issues', 'i', InputOption::VALUE_NONE, 'Only show issues, not success messages.') ; } diff --git a/src/Command/Currencies/UpdateExchangeRatesCommand.php b/src/Command/Currencies/UpdateExchangeRatesCommand.php index b0735cbc..092121b8 100644 --- a/src/Command/Currencies/UpdateExchangeRatesCommand.php +++ b/src/Command/Currencies/UpdateExchangeRatesCommand.php @@ -35,9 +35,10 @@ 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.')] class UpdateExchangeRatesCommand extends Command { - protected static $defaultName = 'partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates'; + protected static $defaultDescription = 'Updates the currency exchange rates.'; protected string $base_current; protected EntityManagerInterface $em; @@ -56,9 +57,7 @@ class UpdateExchangeRatesCommand extends Command protected function configure(): void { - $this - ->setDescription('Updates the currency exchange rates.') - ->addArgument('iso_code', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The ISO Codes of the currencies that should be updated.'); + $this->addArgument('iso_code', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The ISO Codes of the currencies that should be updated.'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -69,7 +68,7 @@ class UpdateExchangeRatesCommand extends Command if (3 !== strlen($this->base_current)) { $io->error('Chosen Base current is not valid. Check your settings!'); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $io->note('Update currency exchange rates with base currency: '.$this->base_current); @@ -106,6 +105,6 @@ class UpdateExchangeRatesCommand extends Command $io->success(sprintf('%d (of %d) currency exchange rates were updated.', $success_counter, count($candidates))); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } diff --git a/src/Command/Logs/ShowEventLogCommand.php b/src/Command/Logs/ShowEventLogCommand.php index 7eef7a2d..6f560738 100644 --- a/src/Command/Logs/ShowEventLogCommand.php +++ b/src/Command/Logs/ShowEventLogCommand.php @@ -36,9 +36,10 @@ 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.')] class ShowEventLogCommand extends Command { - protected static $defaultName = 'partdb:logs:show|app:show-logs'; + protected static $defaultDescription = 'List the last event log entries.'; protected EntityManagerInterface $entityManager; protected TranslatorInterface $translator; protected ElementTypeNameGenerator $elementTypeNameGenerator; @@ -74,7 +75,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 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $io->note("There are a total of ${total_count} log entries in the DB."); @@ -84,21 +85,19 @@ class ShowEventLogCommand extends Command $this->showPage($output, $desc, $limit, $page, $max_page, $showExtra); if ($onePage) { - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } $continue = $io->confirm('Do you want to show the next page?'); ++$page; } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } protected function configure(): void { - $this - ->setDescription('List the last event log entries.') - ->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'How many log entries should be shown per page.', 50) + $this->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'How many log entries should be shown per page.', 50) ->addOption('oldest_first', null, InputOption::VALUE_NONE, 'Show older entries first.') ->addOption('page', 'p', InputOption::VALUE_REQUIRED, 'Which page should be shown?', 1) ->addOption('onePage', null, InputOption::VALUE_NONE, 'Show only one page (dont ask to go to next).') diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php index 3b861b49..4ea3c2c0 100644 --- a/src/Command/Migrations/ConvertBBCodeCommand.php +++ b/src/Command/Migrations/ConvertBBCodeCommand.php @@ -47,6 +47,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')] class ConvertBBCodeCommand extends Command { /** @@ -58,7 +59,7 @@ class ConvertBBCodeCommand extends Command */ protected const BBCODE_REGEX = '/\\[.+\\].*\\[\\/.+\\]/'; - protected static $defaultName = 'partdb:migrations:convert-bbcode|app:convert-bbcode'; + protected static $defaultDescription = 'Converts BBCode used in old Part-DB versions to newly used Markdown'; protected EntityManagerInterface $em; protected PropertyAccessorInterface $propertyAccessor; @@ -76,9 +77,7 @@ class ConvertBBCodeCommand extends Command protected function configure(): void { - $this - ->setDescription('Converts BBCode used in old Part-DB versions to newly used Markdown') - ->setHelp('Older versions of Part-DB (<1.0) used BBCode for rich text formatting. + $this->setHelp('Older versions of Part-DB (<1.0) used BBCode for rich text formatting. Part-DB now uses Markdown which offers more features but is incompatible with BBCode. When you upgrade from an pre 1.0 version you have to run this command to convert your comment fields'); @@ -168,6 +167,6 @@ class ConvertBBCodeCommand extends Command $io->success('Changes saved to DB successfully!'); } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index d436bb1c..b325ca9e 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -33,10 +33,11 @@ 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')] class ImportPartKeeprCommand extends Command { - protected static $defaultName = 'partdb:migrations:import-partkeepr'; + protected static $defaultDescription = 'Import a PartKeepr database XML dump into Part-DB'; protected EntityManagerInterface $em; protected MySQLDumpXMLConverter $xml_converter; @@ -60,7 +61,6 @@ class ImportPartKeeprCommand extends Command protected function configure() { - $this->setDescription('Import a PartKeepr database XML dump into Part-DB'); $this->setHelp('This command allows you to import a PartKeepr database exported by mysqldump as XML file into Part-DB'); $this->addArgument('file', InputArgument::REQUIRED, 'The file to which should be imported.'); @@ -100,7 +100,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 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } //Import the mandatory data @@ -118,7 +118,7 @@ class ImportPartKeeprCommand extends Command $io->success('Imported '.$count.' users.'); } - return 0; + return \Symfony\Component\Console\Command\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 df48ce06..2144dc85 100644 --- a/src/Command/User/ConvertToSAMLUserCommand.php +++ b/src/Command/User/ConvertToSAMLUserCommand.php @@ -30,9 +30,10 @@ 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)')] class ConvertToSAMLUserCommand extends Command { - protected static $defaultName = 'partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user'; + protected static $defaultDescription = 'Converts a local user to a SAML user (and vice versa)'; protected EntityManagerInterface $entityManager; protected bool $saml_enabled; @@ -46,9 +47,7 @@ class ConvertToSAMLUserCommand extends Command protected function configure(): void { - $this - ->setDescription('Converts a local user to a SAML user (and vice versa)') - ->setHelp('This converts a local user, which can login via the login form, to a SAML user, which can only login via SAML. This is useful if you want to migrate from a local user system to a SAML user system.') + $this->setHelp('This converts a local user, which can login via the login form, to a SAML user, which can only login via SAML. This is useful if you want to migrate from a local user system to a SAML user system.') ->addArgument('user', InputArgument::REQUIRED, 'The username (or email) of the user') ->addOption('to-local', null, InputOption::VALUE_NONE, 'Converts a SAML user to a local user') ; @@ -70,7 +69,7 @@ class ConvertToSAMLUserCommand extends Command if (!$user) { $io->error('User not found!'); - return 1; + return \Symfony\Component\Console\Command\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 78724ecf..a1f3d0b9 100644 --- a/src/Command/User/SetPasswordCommand.php +++ b/src/Command/User/SetPasswordCommand.php @@ -34,9 +34,10 @@ 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')] class SetPasswordCommand extends Command { - protected static $defaultName = 'partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password'; + protected static $defaultDescription = 'Sets the password of a user'; protected EntityManagerInterface $entityManager; protected UserPasswordHasherInterface $encoder; @@ -53,9 +54,7 @@ class SetPasswordCommand extends Command protected function configure(): void { - $this - ->setDescription('Sets the password of a user') - ->setHelp('This password allows you to set the password of a user, without knowing the old password.') + $this->setHelp('This password allows you to set the password of a user, without knowing the old password.') ->addArgument('user', InputArgument::REQUIRED, 'The username or email of the user') ; } @@ -70,14 +69,14 @@ class SetPasswordCommand extends Command if (!$user) { $io->error(sprintf('No user with the given username %s found in the database!', $user_name)); - return 1; + return \Symfony\Component\Console\Command\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 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $proceed = $io->confirm( @@ -85,7 +84,7 @@ class SetPasswordCommand extends Command $user->getFullName(true), $user->getID())); if (!$proceed) { - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $success = false; @@ -116,6 +115,6 @@ class SetPasswordCommand extends Command $security_event = new SecurityEvent($user); $this->eventDispatcher->dispatch($security_event, SecurityEvents::PASSWORD_CHANGED); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index 36e933cc..94d65c67 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -31,11 +31,9 @@ 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.')] final class UpgradePermissionsSchemaCommand extends Command { - protected static $defaultName = 'partdb:users:upgrade-permissions-schema'; - protected static $defaultDescription = '(Manually) upgrades the permissions schema of all users to the latest version.'; - private PermissionSchemaUpdater $permissionSchemaUpdater; private EntityManagerInterface $em; private EventCommentHelper $eventCommentHelper; @@ -84,7 +82,7 @@ final class UpgradePermissionsSchemaCommand extends Command if (empty($groups_to_upgrade) && empty($users_to_upgrade)) { $io->success('All users and group permissions schemas are up-to-date. No update needed.'); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } //List all users and groups that need an update @@ -100,7 +98,7 @@ final class UpgradePermissionsSchemaCommand extends Command if(!$io->confirm('Continue with the update?', false)) { $io->warning('Update aborted.'); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } //Update all users and groups diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index 2b913e26..daae874c 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -29,9 +29,10 @@ 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')] class UserEnableCommand extends Command { - protected static $defaultName = 'partdb:users:enable|partdb:user:enable'; + protected static $defaultDescription = 'Enables/Disable the login of one or more users'; protected EntityManagerInterface $entityManager; @@ -44,9 +45,7 @@ class UserEnableCommand extends Command protected function configure(): void { - $this - ->setDescription('Enables/Disable the login of one or more users') - ->setHelp('This allows you to allow or prevent the login of certain user. Use the --disable option to disable the login for the given users') + $this->setHelp('This allows you to allow or prevent the login of certain user. Use the --disable option to disable the login for the given users') ->addArgument('users', InputArgument::IS_ARRAY, 'The usernames of the users to use') ->addOption('all', 'a', InputOption::VALUE_NONE, 'Enable/Disable all users') ->addOption('disable', 'd', InputOption::VALUE_NONE, 'Disable the login of the given users') diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php index 66265dd8..ca8f5364 100644 --- a/src/Command/User/UserListCommand.php +++ b/src/Command/User/UserListCommand.php @@ -28,9 +28,10 @@ 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')] class UserListCommand extends Command { - protected static $defaultName = 'partdb:users:list|users:list'; + protected static $defaultDescription = 'Lists all users'; protected EntityManagerInterface $entityManager; @@ -43,9 +44,7 @@ class UserListCommand extends Command protected function configure(): void { - $this - ->setDescription('Lists all users') - ->setHelp('This command lists all users in the database.') + $this->setHelp('This command lists all users in the database.') ->addOption('local', 'l', null, 'Only list local users') ->addOption('saml', 's', null, 'Only list SAML users') ; diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php index 3d57a4dc..f01bcedb 100644 --- a/src/Command/User/UsersPermissionsCommand.php +++ b/src/Command/User/UsersPermissionsCommand.php @@ -34,11 +34,9 @@ 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')] class UsersPermissionsCommand extends Command { - protected static $defaultName = 'partdb:users:permissions|partdb:user:permissions'; - protected static $defaultDescription = 'View and edit the permissions of a given user'; - protected EntityManagerInterface $entityManager; protected UserRepository $userRepository; protected PermissionManager $permissionResolver; diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php index a5437684..0e0408e7 100644 --- a/src/Command/VersionCommand.php +++ b/src/Command/VersionCommand.php @@ -27,9 +27,10 @@ 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.')] class VersionCommand extends Command { - protected static $defaultName = 'partdb:version|app:version'; + protected static $defaultDescription = 'Shows the currently installed version of Part-DB.'; protected VersionManagerInterface $versionManager; protected GitVersionInfo $gitVersionInfo; @@ -43,9 +44,6 @@ class VersionCommand extends Command protected function configure(): void { - $this - ->setDescription('Shows the currently installed version of Part-DB.') - ; } protected function execute(InputInterface $input, OutputInterface $output): int @@ -66,6 +64,6 @@ class VersionCommand extends Command $io->info('OS: '. php_uname()); $io->info('PHP extension: '. implode(', ', get_loaded_extensions())); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } \ No newline at end of file diff --git a/src/Controller/AdminPages/AttachmentTypeController.php b/src/Controller/AdminPages/AttachmentTypeController.php index 6ff5d930..0b85f4a0 100644 --- a/src/Controller/AdminPages/AttachmentTypeController.php +++ b/src/Controller/AdminPages/AttachmentTypeController.php @@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/attachment_type") - */ +#[Route(path: '/attachment_type')] class AttachmentTypeController extends BaseAdminController { protected string $entity_class = AttachmentType::class; @@ -48,44 +46,34 @@ class AttachmentTypeController extends BaseAdminController protected string $attachment_class = AttachmentTypeAttachment::class; protected ?string $parameter_class = AttachmentTypeParameter::class; - /** - * @Route("/{id}", name="attachment_type_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'attachment_type_delete', methods: ['DELETE'])] public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'attachment_type_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="attachment_type_new") - * @Route("/{id}/clone", name="attachment_type_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'attachment_type_new')] + #[Route(path: '/{id}/clone', name: 'attachment_type_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="attachment_type_export_all") - */ + #[Route(path: '/export', name: 'attachment_type_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="attachment_type_export") - */ + #[Route(path: '/{id}/export', name: 'attachment_type_export')] public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index d5f00767..65a17668 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -245,7 +245,7 @@ abstract class BaseAdminController extends AbstractController /** @var AbstractPartsContainingRepository $repo */ $repo = $this->entityManager->getRepository($this->entity_class); - return $this->renderForm($this->twig_template, [ + return $this->render($this->twig_template, [ 'entity' => $entity, 'form' => $form, 'route_base' => $this->route_base, @@ -402,7 +402,7 @@ abstract class BaseAdminController extends AbstractController } ret: - return $this->renderForm($this->twig_template, [ + return $this->render($this->twig_template, [ 'entity' => $new_entity, 'form' => $form, 'import_form' => $import_form, diff --git a/src/Controller/AdminPages/CategoryController.php b/src/Controller/AdminPages/CategoryController.php index 4f247a1d..622de1eb 100644 --- a/src/Controller/AdminPages/CategoryController.php +++ b/src/Controller/AdminPages/CategoryController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/category") - */ +#[Route(path: '/category')] class CategoryController extends BaseAdminController { protected string $entity_class = Category::class; @@ -47,44 +45,34 @@ class CategoryController extends BaseAdminController protected string $attachment_class = CategoryAttachment::class; protected ?string $parameter_class = CategoryParameter::class; - /** - * @Route("/{id}", name="category_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'category_delete', methods: ['DELETE'])] public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'category_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="category_new") - * @Route("/{id}/clone", name="category_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'category_new')] + #[Route(path: '/{id}/clone', name: 'category_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="category_export_all") - */ + #[Route(path: '/export', name: 'category_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="category_export") - */ + #[Route(path: '/{id}/export', name: 'category_export')] public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/CurrencyController.php b/src/Controller/AdminPages/CurrencyController.php index bda992c5..d607c792 100644 --- a/src/Controller/AdminPages/CurrencyController.php +++ b/src/Controller/AdminPages/CurrencyController.php @@ -52,10 +52,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** - * @Route("/currency") - * * Class CurrencyController */ +#[Route(path: '/currency')] class CurrencyController extends BaseAdminController { protected string $entity_class = Currency::class; @@ -98,9 +97,7 @@ class CurrencyController extends BaseAdminController ); } - /** - * @Route("/{id}", name="currency_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'currency_delete', methods: ['DELETE'])] public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); @@ -131,36 +128,28 @@ class CurrencyController extends BaseAdminController return true; } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'currency_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="currency_new") - * @Route("/{id}/clone", name="currency_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'currency_new')] + #[Route(path: '/{id}/clone', name: 'currency_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="currency_export_all") - */ + #[Route(path: '/export', name: 'currency_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="currency_export") - */ + #[Route(path: '/{id}/export', name: 'currency_export')] public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/FootprintController.php b/src/Controller/AdminPages/FootprintController.php index ba37256c..8edd0b06 100644 --- a/src/Controller/AdminPages/FootprintController.php +++ b/src/Controller/AdminPages/FootprintController.php @@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/footprint") - */ +#[Route(path: '/footprint')] class FootprintController extends BaseAdminController { protected string $entity_class = Footprint::class; @@ -48,44 +46,34 @@ class FootprintController extends BaseAdminController protected string $attachment_class = FootprintAttachment::class; protected ?string $parameter_class = FootprintParameter::class; - /** - * @Route("/{id}", name="footprint_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'footprint_delete', methods: ['DELETE'])] public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'footprint_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="footprint_new") - * @Route("/{id}/clone", name="footprint_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'footprint_new')] + #[Route(path: '/{id}/clone', name: 'footprint_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="footprint_export_all") - */ + #[Route(path: '/export', name: 'footprint_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="footprint_export") - */ + #[Route(path: '/{id}/export', name: 'footprint_export')] public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/LabelProfileController.php b/src/Controller/AdminPages/LabelProfileController.php index 1b3579db..b89858dd 100644 --- a/src/Controller/AdminPages/LabelProfileController.php +++ b/src/Controller/AdminPages/LabelProfileController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/label_profile") - */ +#[Route(path: '/label_profile')] class LabelProfileController extends BaseAdminController { protected string $entity_class = LabelProfile::class; @@ -48,44 +46,34 @@ class LabelProfileController extends BaseAdminController //Just a placeholder protected ?string $parameter_class = null; - /** - * @Route("/{id}", name="label_profile_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'label_profile_delete', methods: ['DELETE'])] public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="label_profile_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'label_profile_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="label_profile_new") - * @Route("/{id}/clone", name="label_profile_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'label_profile_new')] + #[Route(path: '/{id}/clone', name: 'label_profile_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?LabelProfile $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="label_profile_export_all") - */ + #[Route(path: '/export', name: 'label_profile_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="label_profile_export") - */ + #[Route(path: '/{id}/export', name: 'label_profile_export')] public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/ManufacturerController.php b/src/Controller/AdminPages/ManufacturerController.php index 2ded7d10..09311e25 100644 --- a/src/Controller/AdminPages/ManufacturerController.php +++ b/src/Controller/AdminPages/ManufacturerController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/manufacturer") - */ +#[Route(path: '/manufacturer')] class ManufacturerController extends BaseAdminController { protected string $entity_class = Manufacturer::class; @@ -48,45 +46,36 @@ class ManufacturerController extends BaseAdminController protected ?string $parameter_class = ManufacturerParameter::class; /** - * @Route("/{id}", name="manufacturer_delete", methods={"DELETE"}) - * * @return RedirectResponse */ + #[Route(path: '/{id}', name: 'manufacturer_delete', methods: ['DELETE'])] public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="manufacturer_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'manufacturer_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="manufacturer_new") - * @Route("/{id}/clone", name="manufacturer_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'manufacturer_new')] + #[Route(path: '/{id}/clone', name: 'manufacturer_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="manufacturer_export_all") - */ + #[Route(path: '/export', name: 'manufacturer_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="manufacturer_export") - */ + #[Route(path: '/{id}/export', name: 'manufacturer_export')] public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/MeasurementUnitController.php b/src/Controller/AdminPages/MeasurementUnitController.php index 402c2018..b8a566ec 100644 --- a/src/Controller/AdminPages/MeasurementUnitController.php +++ b/src/Controller/AdminPages/MeasurementUnitController.php @@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/measurement_unit") - */ +#[Route(path: '/measurement_unit')] class MeasurementUnitController extends BaseAdminController { protected string $entity_class = MeasurementUnit::class; @@ -48,44 +46,34 @@ class MeasurementUnitController extends BaseAdminController protected string $attachment_class = MeasurementUnitAttachment::class; protected ?string $parameter_class = MeasurementUnitParameter::class; - /** - * @Route("/{id}", name="measurement_unit_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'measurement_unit_delete', methods: ['DELETE'])] public function delete(Request $request, MeasurementUnit $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="measurement_unit_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'measurement_unit_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="measurement_unit_new") - * @Route("/{id}/clone", name="measurement_unit_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'measurement_unit_new')] + #[Route(path: '/{id}/clone', name: 'measurement_unit_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="measurement_unit_export_all") - */ + #[Route(path: '/export', name: 'measurement_unit_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="measurement_unit_export") - */ + #[Route(path: '/{id}/export', name: 'measurement_unit_export')] public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/ProjectAdminController.php b/src/Controller/AdminPages/ProjectAdminController.php index 08d088ec..16bf6df1 100644 --- a/src/Controller/AdminPages/ProjectAdminController.php +++ b/src/Controller/AdminPages/ProjectAdminController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/project") - */ +#[Route(path: '/project')] class ProjectAdminController extends BaseAdminController { protected string $entity_class = Project::class; @@ -47,44 +45,34 @@ class ProjectAdminController extends BaseAdminController protected string $attachment_class = ProjectAttachment::class; protected ?string $parameter_class = ProjectParameter::class; - /** - * @Route("/{id}", name="project_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'project_delete', methods: ['DELETE'])] public function delete(Request $request, Project $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="project_edit") - * @Route("/{id}/edit", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'project_edit')] + #[Route(path: '/{id}/edit', requirements: ['id' => '\d+'])] public function edit(Project $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="project_new") - * @Route("/{id}/clone", name="device_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'project_new')] + #[Route(path: '/{id}/clone', name: 'device_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Project $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="project_export_all") - */ + #[Route(path: '/export', name: 'project_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="project_export") - */ + #[Route(path: '/{id}/export', name: 'project_export')] public function exportEntity(Project $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/StorelocationController.php b/src/Controller/AdminPages/StorelocationController.php index 080690ab..36e8da34 100644 --- a/src/Controller/AdminPages/StorelocationController.php +++ b/src/Controller/AdminPages/StorelocationController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/store_location") - */ +#[Route(path: '/store_location')] class StorelocationController extends BaseAdminController { protected string $entity_class = Storelocation::class; @@ -47,44 +45,34 @@ class StorelocationController extends BaseAdminController protected string $attachment_class = StorelocationAttachment::class; protected ?string $parameter_class = StorelocationParameter::class; - /** - * @Route("/{id}", name="store_location_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'store_location_delete', methods: ['DELETE'])] public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="store_location_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'store_location_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="store_location_new") - * @Route("/{id}/clone", name="store_location_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'store_location_new')] + #[Route(path: '/{id}/clone', name: 'store_location_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="store_location_export_all") - */ + #[Route(path: '/export', name: 'store_location_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="store_location_export") - */ + #[Route(path: '/{id}/export', name: 'store_location_export')] public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/SupplierController.php b/src/Controller/AdminPages/SupplierController.php index f7505c6a..c28a114d 100644 --- a/src/Controller/AdminPages/SupplierController.php +++ b/src/Controller/AdminPages/SupplierController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/supplier") - */ +#[Route(path: '/supplier')] class SupplierController extends BaseAdminController { protected string $entity_class = Supplier::class; @@ -47,44 +45,34 @@ class SupplierController extends BaseAdminController protected string $attachment_class = SupplierAttachment::class; protected ?string $parameter_class = SupplierParameter::class; - /** - * @Route("/{id}", name="supplier_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'supplier_delete', methods: ['DELETE'])] public function delete(Request $request, Supplier $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="supplier_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'supplier_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Supplier $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="supplier_new") - * @Route("/{id}/clone", name="supplier_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'supplier_new')] + #[Route(path: '/{id}/clone', name: 'supplier_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="supplier_export_all") - */ + #[Route(path: '/export', name: 'supplier_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="supplier_export") - */ + #[Route(path: '/{id}/export', name: 'supplier_export')] public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AttachmentFileController.php b/src/Controller/AttachmentFileController.php index 8df2a8bc..16b07ab9 100644 --- a/src/Controller/AttachmentFileController.php +++ b/src/Controller/AttachmentFileController.php @@ -42,9 +42,8 @@ class AttachmentFileController extends AbstractController { /** * Download the selected attachment. - * - * @Route("/attachment/{id}/download", name="attachment_download") */ + #[Route(path: '/attachment/{id}/download', name: 'attachment_download')] public function download(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse { $this->denyAccessUnlessGranted('read', $attachment); @@ -72,9 +71,8 @@ class AttachmentFileController extends AbstractController /** * View the attachment. - * - * @Route("/attachment/{id}/view", name="attachment_view") */ + #[Route(path: '/attachment/{id}/view', name: 'attachment_view')] public function view(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse { $this->denyAccessUnlessGranted('read', $attachment); @@ -100,9 +98,7 @@ class AttachmentFileController extends AbstractController return $response; } - /** - * @Route("/attachment/list", name="attachment_list") - */ + #[Route(path: '/attachment/list', name: 'attachment_list')] public function attachmentsTable(Request $request, DataTableFactory $dataTableFactory, NodesListBuilder $nodesListBuilder): Response { $this->denyAccessUnlessGranted('@attachments.list_attachments'); @@ -124,7 +120,7 @@ class AttachmentFileController extends AbstractController return $this->render('attachment_list.html.twig', [ 'datatable' => $table, - 'filterForm' => $filterForm->createView(), + 'filterForm' => $filterForm, ]); } } diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 5aa8a371..645ef8f9 100644 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -39,9 +39,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/group") - */ +#[Route(path: '/group')] class GroupController extends BaseAdminController { protected string $entity_class = Group::class; @@ -51,10 +49,8 @@ class GroupController extends BaseAdminController protected string $attachment_class = GroupAttachment::class; protected ?string $parameter_class = GroupParameter::class; - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit") - * @Route("/{id}/", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'group_edit')] + #[Route(path: '/{id}/', requirements: ['id' => '\d+'])] public function edit(Group $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response { //Do an upgrade of the permission schema if needed (so the user can see the permissions a user get on next request (even if it was not done yet) @@ -82,35 +78,27 @@ class GroupController extends BaseAdminController return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="group_new") - * @Route("/{id}/clone", name="group_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'group_new')] + #[Route(path: '/{id}/clone', name: 'group_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/{id}", name="group_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'group_delete', methods: ['DELETE'])] public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/export", name="group_export_all") - */ + #[Route(path: '/export', name: 'group_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="group_export") - */ + #[Route(path: '/{id}/export', name: 'group_export')] public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/HomepageController.php b/src/Controller/HomepageController.php index 51447c17..fe3025e9 100644 --- a/src/Controller/HomepageController.php +++ b/src/Controller/HomepageController.php @@ -61,9 +61,7 @@ class HomepageController extends AbstractController return $banner; } - /** - * @Route("/", name="homepage") - */ + #[Route(path: '/', name: 'homepage')] public function homepage(Request $request, GitVersionInfo $versionInfo, EntityManagerInterface $entityManager): Response { if ($this->isGranted('@tools.lastActivity')) { diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php index 769639d4..02b44112 100644 --- a/src/Controller/LabelController.php +++ b/src/Controller/LabelController.php @@ -59,9 +59,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @Route("/label") - */ +#[Route(path: '/label')] class LabelController extends AbstractController { protected LabelGenerator $labelGenerator; @@ -80,10 +78,8 @@ class LabelController extends AbstractController $this->translator = $translator; } - /** - * @Route("/dialog", name="label_dialog") - * @Route("/{profile}/dialog", name="label_dialog_profile") - */ + #[Route(path: '/dialog', name: 'label_dialog')] + #[Route(path: '/{profile}/dialog', name: 'label_dialog_profile')] public function generator(Request $request, ?LabelProfile $profile = null): Response { $this->denyAccessUnlessGranted('@labels.create_labels'); @@ -146,7 +142,7 @@ class LabelController extends AbstractController } } - return $this->renderForm('label_system/dialog.html.twig', [ + return $this->render('label_system/dialog.html.twig', [ 'form' => $form, 'pdf_data' => $pdf_data, 'filename' => $filename, diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index 24be85c9..28d7cbac 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -49,9 +49,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/log") - */ +#[Route(path: '/log')] class LogController extends AbstractController { protected EntityManagerInterface $entityManager; @@ -66,10 +64,9 @@ class LogController extends AbstractController } /** - * @Route("/", name="log_view") - * * @return Response */ + #[Route(path: '/', name: 'log_view')] public function showLogs(Request $request, DataTableFactory $dataTable): Response { $this->denyAccessUnlessGranted('@system.show_logs'); @@ -93,17 +90,17 @@ class LogController extends AbstractController return $this->render('log_system/log_list.html.twig', [ 'datatable' => $table, - 'filterForm' => $filterForm->createView(), + 'filterForm' => $filterForm, ]); } /** - * @Route("/{id}/details", name="log_details") * @param Request $request * @param AbstractLogEntry $logEntry * @return Response */ - public function logDetails(Request $request, AbstractLogEntry $logEntry, LogEntryExtraFormatter $logEntryExtraFormatter, + #[Route(path: '/{id}/details', name: 'log_details')] + public function logDetails(AbstractLogEntry $logEntry, LogEntryExtraFormatter $logEntryExtraFormatter, LogLevelHelper $logLevelHelper, LogTargetHelper $logTargetHelper, EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('show_details', $logEntry); @@ -123,9 +120,7 @@ class LogController extends AbstractController ]); } - /** - * @Route("/{id}/delete", name="log_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}/delete', name: 'log_delete', methods: ['DELETE'])] public function deleteLogEntry(Request $request, AbstractLogEntry $logEntry, EntityManagerInterface $entityManager): RedirectResponse { $this->denyAccessUnlessGranted('delete', $logEntry); @@ -142,9 +137,7 @@ class LogController extends AbstractController } - /** - * @Route("/undo", name="log_undo", methods={"POST"}) - */ + #[Route(path: '/undo', name: 'log_undo', methods: ['POST'])] public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper): RedirectResponse { $mode = EventUndoHelper::MODE_UNDO; diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index b7a3fd0e..20a2006c 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -59,9 +59,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; use function Symfony\Component\Translation\t; -/** - * @Route("/part") - */ +#[Route(path: '/part')] class PartController extends AbstractController { protected PricedetailHelper $pricedetailHelper; @@ -77,11 +75,11 @@ class PartController extends AbstractController } /** - * @Route("/{id}/info/{timestamp}", name="part_info") - * @Route("/{id}", requirements={"id"="\d+"}) * * @throws Exception */ + #[Route(path: '/{id}/info/{timestamp}', name: 'part_info')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper, DataTableFactory $dataTable, ParameterExtractor $parameterExtractor, PartLotWithdrawAddHelper $withdrawAddHelper, ?string $timestamp = null): Response { @@ -129,9 +127,7 @@ class PartController extends AbstractController ); } - /** - * @Route("/{id}/edit", name="part_edit") - */ + #[Route(path: '/{id}/edit', name: 'part_edit')] public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator, AttachmentSubmitHandler $attachmentSubmitHandler): Response { @@ -182,16 +178,14 @@ class PartController extends AbstractController $this->addFlash('error', 'part.edited_flash.invalid'); } - return $this->renderForm('parts/edit/edit_part_info.html.twig', + return $this->render('parts/edit/edit_part_info.html.twig', [ 'part' => $part, 'form' => $form, ]); } - /** - * @Route("/{id}/delete", name="part_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}/delete', name: 'part_delete', methods: ['DELETE'])] public function delete(Request $request, Part $part, EntityManagerInterface $entityManager): RedirectResponse { $this->denyAccessUnlessGranted('delete', $part); @@ -213,12 +207,12 @@ class PartController extends AbstractController } /** - * @Route("/new", name="part_new") - * @Route("/{id}/clone", name="part_clone") - * @Route("/new_build_part/{project_id}", name="part_new_build_part") * @ParamConverter("part", options={"id" = "id"}) * @ParamConverter("project", options={"id" = "project_id"}) */ + #[Route(path: '/new', name: 'part_new')] + #[Route(path: '/{id}/clone', name: 'part_clone')] + #[Route(path: '/new_build_part/{project_id}', name: 'part_new_build_part')] public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator, AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper, ?Part $part = null, ?Project $project = null): Response @@ -328,16 +322,14 @@ class PartController extends AbstractController $this->addFlash('error', 'part.created_flash.invalid'); } - return $this->renderForm('parts/edit/new_part.html.twig', + return $this->render('parts/edit/new_part.html.twig', [ 'part' => $new_part, 'form' => $form, ]); } - /** - * @Route("/{id}/add_withdraw", name="part_add_withdraw", methods={"POST"}) - */ + #[Route(path: '/{id}/add_withdraw', name: 'part_add_withdraw', methods: ['POST'])] public function withdrawAddHandler(Part $part, Request $request, EntityManagerInterface $em, PartLotWithdrawAddHelper $withdrawAddHelper): Response { if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) { diff --git a/src/Controller/PartImportExportController.php b/src/Controller/PartImportExportController.php index 81754b3b..fd37c045 100644 --- a/src/Controller/PartImportExportController.php +++ b/src/Controller/PartImportExportController.php @@ -49,10 +49,10 @@ class PartImportExportController extends AbstractController } /** - * @Route("/parts/import", name="parts_import") * @param Request $request * @return Response */ + #[Route(path: '/parts/import', name: 'parts_import')] public function importParts(Request $request): Response { $this->denyAccessUnlessGranted('@parts.import'); @@ -109,7 +109,7 @@ class PartImportExportController extends AbstractController ret: - return $this->renderForm('parts/import/parts_import.html.twig', [ + return $this->render('parts/import/parts_import.html.twig', [ 'import_form' => $import_form, 'imported_entities' => $entities ?? [], 'import_errors' => $errors ?? [], @@ -117,9 +117,9 @@ class PartImportExportController extends AbstractController } /** - * @Route("/parts/export", name="parts_export", methods={"GET"}) * @return Response */ + #[Route(path: '/parts/export', name: 'parts_export', methods: ['GET'])] public function exportParts(Request $request, EntityExporter $entityExporter): Response { $ids = $request->query->get('ids', ''); diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php index 52d65d2a..271adb06 100644 --- a/src/Controller/PartListsController.php +++ b/src/Controller/PartListsController.php @@ -62,9 +62,7 @@ class PartListsController extends AbstractController $this->translator = $translator; } - /** - * @Route("/table/action", name="table_action", methods={"POST"}) - */ + #[Route(path: '/table/action', name: 'table_action', methods: ['POST'])] public function tableAction(Request $request, PartsTableActionHandler $actionHandler): Response { $this->denyAccessUnlessGranted('@parts.edit'); @@ -175,10 +173,9 @@ class PartListsController extends AbstractController } /** - * @Route("/category/{id}/parts", name="part_list_category") - * * @return JsonResponse|Response */ + #[Route(path: '/category/{id}/parts', name: 'part_list_category')] public function showCategory(Category $category, Request $request): Response { $this->denyAccessUnlessGranted('@categories.read'); @@ -197,10 +194,9 @@ class PartListsController extends AbstractController } /** - * @Route("/footprint/{id}/parts", name="part_list_footprint") - * * @return JsonResponse|Response */ + #[Route(path: '/footprint/{id}/parts', name: 'part_list_footprint')] public function showFootprint(Footprint $footprint, Request $request): Response { $this->denyAccessUnlessGranted('@footprints.read'); @@ -219,10 +215,9 @@ class PartListsController extends AbstractController } /** - * @Route("/manufacturer/{id}/parts", name="part_list_manufacturer") - * * @return JsonResponse|Response */ + #[Route(path: '/manufacturer/{id}/parts', name: 'part_list_manufacturer')] public function showManufacturer(Manufacturer $manufacturer, Request $request): Response { $this->denyAccessUnlessGranted('@manufacturers.read'); @@ -241,10 +236,9 @@ class PartListsController extends AbstractController } /** - * @Route("/store_location/{id}/parts", name="part_list_store_location") - * * @return JsonResponse|Response */ + #[Route(path: '/store_location/{id}/parts', name: 'part_list_store_location')] public function showStorelocation(Storelocation $storelocation, Request $request): Response { $this->denyAccessUnlessGranted('@storelocations.read'); @@ -263,10 +257,9 @@ class PartListsController extends AbstractController } /** - * @Route("/supplier/{id}/parts", name="part_list_supplier") - * * @return JsonResponse|Response */ + #[Route(path: '/supplier/{id}/parts', name: 'part_list_supplier')] public function showSupplier(Supplier $supplier, Request $request): Response { $this->denyAccessUnlessGranted('@suppliers.read'); @@ -285,10 +278,9 @@ class PartListsController extends AbstractController } /** - * @Route("/parts/by_tag/{tag}", name="part_list_tags", requirements={"tag": ".*"}) - * * @return JsonResponse|Response */ + #[Route(path: '/parts/by_tag/{tag}', name: 'part_list_tags', requirements: ['tag' => '.*'])] public function showTag(string $tag, Request $request): Response { $tag = trim($tag); @@ -330,10 +322,9 @@ class PartListsController extends AbstractController } /** - * @Route("/parts/search", name="parts_search") - * * @return JsonResponse|Response */ + #[Route(path: '/parts/search', name: 'parts_search')] public function showSearch(Request $request, DataTableFactory $dataTable): Response { $searchFilter = $this->searchRequestToFilter($request); @@ -353,10 +344,9 @@ class PartListsController extends AbstractController } /** - * @Route("/parts", name="parts_show_all") - * * @return Response */ + #[Route(path: '/parts', name: 'parts_show_all')] public function showAll(Request $request): Response { return $this->showListWithFilter($request,'parts/lists/all_list.html.twig'); diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 56ba6b7d..2db1c1a7 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -47,9 +47,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; use function Symfony\Component\Translation\t; -/** - * @Route("/project") - */ +#[Route(path: '/project')] class ProjectController extends AbstractController { private DataTableFactory $dataTableFactory; @@ -59,9 +57,7 @@ class ProjectController extends AbstractController $this->dataTableFactory = $dataTableFactory; } - /** - * @Route("/{id}/info", name="project_info", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/info', name: 'project_info', requirements: ['id' => '\d+'])] public function info(Project $project, Request $request, ProjectBuildHelper $buildHelper): Response { $this->denyAccessUnlessGranted('read', $project); @@ -80,9 +76,7 @@ class ProjectController extends AbstractController ]); } - /** - * @Route("/{id}/build", name="project_build", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/build', name: 'project_build', requirements: ['id' => '\d+'])] public function build(Project $project, Request $request, ProjectBuildHelper $buildHelper, EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('read', $project); @@ -117,7 +111,7 @@ class ProjectController extends AbstractController $this->addFlash('error', 'project.build.flash.invalid_input'); } - return $this->renderForm('projects/build/build.html.twig', [ + return $this->render('projects/build/build.html.twig', [ 'buildHelper' => $buildHelper, 'project' => $project, 'build_request' => $projectBuildRequest, @@ -126,9 +120,7 @@ class ProjectController extends AbstractController ]); } - /** - * @Route("/{id}/import_bom", name="project_import_bom", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/import_bom', name: 'project_import_bom', requirements: ['id' => '\d+'])] public function importBOM(Request $request, EntityManagerInterface $entityManager, Project $project, BOMImporter $BOMImporter, ValidatorInterface $validator): Response { @@ -195,7 +187,7 @@ class ProjectController extends AbstractController } } - return $this->renderForm('projects/import_bom.html.twig', [ + return $this->render('projects/import_bom.html.twig', [ 'project' => $project, 'form' => $form, 'errors' => $errors ?? null, @@ -203,11 +195,11 @@ class ProjectController extends AbstractController } /** - * @Route("/add_parts", name="project_add_parts_no_id") - * @Route("/{id}/add_parts", name="project_add_parts", requirements={"id"="\d+"}) * @param Request $request * @param Project|null $project */ + #[Route(path: '/add_parts', name: 'project_add_parts_no_id')] + #[Route(path: '/{id}/add_parts', name: 'project_add_parts', requirements: ['id' => '\d+'])] public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response { if($project) { @@ -274,7 +266,7 @@ class ProjectController extends AbstractController return $this->redirectToRoute('project_info', ['id' => $target_project->getID()]); } - return $this->renderForm('projects/add_parts.html.twig', [ + return $this->render('projects/add_parts.html.twig', [ 'project' => $project, 'form' => $form, ]); diff --git a/src/Controller/ScanController.php b/src/Controller/ScanController.php index 8c0c9ad8..1c7a2670 100644 --- a/src/Controller/ScanController.php +++ b/src/Controller/ScanController.php @@ -51,9 +51,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/scan") - */ +#[Route(path: '/scan')] class ScanController extends AbstractController { protected BarcodeRedirector $barcodeParser; @@ -65,9 +63,7 @@ class ScanController extends AbstractController $this->barcodeNormalizer = $barcodeNormalizer; } - /** - * @Route("", name="scan_dialog") - */ + #[Route(path: '', name: 'scan_dialog')] public function dialog(Request $request): Response { $this->denyAccessUnlessGranted('@tools.label_scanner'); @@ -91,7 +87,7 @@ class ScanController extends AbstractController } } - return $this->renderForm('label_system/scanner/scanner.html.twig', [ + return $this->render('label_system/scanner/scanner.html.twig', [ 'form' => $form, ]); } diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 026e18c1..bd696e1e 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -57,9 +57,7 @@ class SecurityController extends AbstractController $this->allow_email_pw_reset = $allow_email_pw_reset; } - /** - * @Route("/login", name="login", methods={"GET", "POST"}) - */ + #[Route(path: '/login', name: 'login', methods: ['GET', 'POST'])] public function login(AuthenticationUtils $authenticationUtils): Response { // get the login error if there is one @@ -75,10 +73,9 @@ class SecurityController extends AbstractController } /** - * @Route("/pw_reset/request", name="pw_reset_request") - * * @return RedirectResponse|Response */ + #[Route(path: '/pw_reset/request', name: 'pw_reset_request')] public function requestPwReset(PasswordResetManager $passwordReset, Request $request) { if (!$this->allow_email_pw_reset) { @@ -113,16 +110,15 @@ class SecurityController extends AbstractController return $this->redirectToRoute('login'); } - return $this->renderForm('security/pw_reset_request.html.twig', [ + return $this->render('security/pw_reset_request.html.twig', [ 'form' => $form, ]); } /** - * @Route("/pw_reset/new_pw/{user}/{token}", name="pw_reset_new_pw") - * * @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) { if (!$this->allow_email_pw_reset) { @@ -187,14 +183,12 @@ class SecurityController extends AbstractController } } - return $this->renderForm('security/pw_reset_new_pw.html.twig', [ + return $this->render('security/pw_reset_new_pw.html.twig', [ 'form' => $form, ]); } - /** - * @Route("/logout", name="logout") - */ + #[Route(path: '/logout', name: 'logout')] public function logout(): void { throw new RuntimeException('Will be intercepted before getting here'); diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php index 18cca638..7ea9a8bd 100644 --- a/src/Controller/SelectAPIController.php +++ b/src/Controller/SelectAPIController.php @@ -37,10 +37,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** - * @Route("/select_api") - * * This endpoint is used by the select2 library to dynamically load data (used in the multiselect action helper in parts lists) */ +#[Route(path: '/select_api')] class SelectAPIController extends AbstractController { private NodesListBuilder $nodesListBuilder; @@ -54,49 +53,37 @@ class SelectAPIController extends AbstractController $this->choiceHelper = $choiceHelper; } - /** - * @Route("/category", name="select_category") - */ + #[Route(path: '/category', name: 'select_category')] public function category(): Response { return $this->getResponseForClass(Category::class); } - /** - * @Route("/footprint", name="select_footprint") - */ + #[Route(path: '/footprint', name: 'select_footprint')] public function footprint(): Response { return $this->getResponseForClass(Footprint::class, true); } - /** - * @Route("/manufacturer", name="select_manufacturer") - */ + #[Route(path: '/manufacturer', name: 'select_manufacturer')] public function manufacturer(): Response { return $this->getResponseForClass(Manufacturer::class, true); } - /** - * @Route("/measurement_unit", name="select_measurement_unit") - */ + #[Route(path: '/measurement_unit', name: 'select_measurement_unit')] public function measurement_unit(): Response { return $this->getResponseForClass(MeasurementUnit::class, true); } - /** - * @Route("/project", name="select_project") - */ + #[Route(path: '/project', name: 'select_project')] public function projects(): Response { return $this->getResponseForClass(Project::class, false); } - /** - * @Route("/export_level", name="select_export_level") - */ + #[Route(path: '/export_level', name: 'select_export_level')] public function exportLevel(): Response { $entries = [ @@ -114,9 +101,9 @@ class SelectAPIController extends AbstractController } /** - * @Route("/label_profiles", name="select_label_profiles") * @return Response */ + #[Route(path: '/label_profiles', name: 'select_label_profiles')] public function labelProfiles(EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('@labels.create_labels'); @@ -135,9 +122,9 @@ class SelectAPIController extends AbstractController } /** - * @Route("/label_profiles_lot", name="select_label_profiles_lot") * @return Response */ + #[Route(path: '/label_profiles_lot', name: 'select_label_profiles_lot')] public function labelProfilesLot(EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('@labels.create_labels'); diff --git a/src/Controller/StatisticsController.php b/src/Controller/StatisticsController.php index d9c467f4..6ff09e83 100644 --- a/src/Controller/StatisticsController.php +++ b/src/Controller/StatisticsController.php @@ -48,9 +48,7 @@ use Symfony\Component\Routing\Annotation\Route; class StatisticsController extends AbstractController { - /** - * @Route("/statistics", name="statistics_view") - */ + #[Route(path: '/statistics', name: 'statistics_view')] public function showStatistics(StatisticsHelper $helper): Response { $this->denyAccessUnlessGranted('@tools.statistics'); diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index 3ef68b8f..56711d43 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -32,14 +32,10 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGenerator; -/** - * @Route("/tools") - */ +#[Route(path: '/tools')] class ToolsController extends AbstractController { - /** - * @Route("/reel_calc", name="tools_reel_calculator") - */ + #[Route(path: '/reel_calc', name: 'tools_reel_calculator')] public function reelCalculator(): Response { $this->denyAccessUnlessGranted('@tools.reel_calculator'); @@ -47,9 +43,7 @@ class ToolsController extends AbstractController return $this->render('tools/reel_calculator/reel_calculator.html.twig'); } - /** - * @Route("/server_infos", name="tools_server_infos") - */ + #[Route(path: '/server_infos', name: 'tools_server_infos')] public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper, AttachmentSubmitHandler $attachmentSubmitHandler): Response { @@ -98,9 +92,9 @@ class ToolsController extends AbstractController } /** - * @Route("/builtin_footprints", name="tools_builtin_footprints_viewer") * @return Response */ + #[Route(path: '/builtin_footprints', name: 'tools_builtin_footprints_viewer')] public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator): Response { $this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer'); @@ -121,9 +115,9 @@ class ToolsController extends AbstractController } /** - * @Route("/ic_logos", name="tools_ic_logos") * @return Response */ + #[Route(path: '/ic_logos', name: 'tools_ic_logos')] public function icLogos(): Response { $this->denyAccessUnlessGranted('@tools.ic_logos'); diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php index 6ab3b420..806dd4d2 100644 --- a/src/Controller/TreeController.php +++ b/src/Controller/TreeController.php @@ -36,9 +36,8 @@ use Symfony\Component\Routing\Annotation\Route; /** * This controller has the purpose to provide the data for all treeviews. - * - * @Route("/tree") */ +#[Route(path: '/tree')] class TreeController extends AbstractController { protected TreeViewGenerator $treeGenerator; @@ -48,9 +47,7 @@ class TreeController extends AbstractController $this->treeGenerator = $treeGenerator; } - /** - * @Route("/tools", name="tree_tools") - */ + #[Route(path: '/tools', name: 'tree_tools')] public function tools(ToolsTreeBuilder $builder): JsonResponse { $tree = $builder->getTree(); @@ -58,90 +55,78 @@ class TreeController extends AbstractController return new JsonResponse($tree); } - /** - * @Route("/category/{id}", name="tree_category") - * @Route("/categories", name="tree_category_root") - */ + #[Route(path: '/category/{id}', name: 'tree_category')] + #[Route(path: '/categories', name: 'tree_category_root')] public function categoryTree(?Category $category = null): JsonResponse { 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", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/footprint/{id}", name="tree_footprint") - * @Route("/footprints", name="tree_footprint_root") - */ + #[Route(path: '/footprint/{id}', name: 'tree_footprint')] + #[Route(path: '/footprints', name: 'tree_footprint_root')] public function footprintTree(?Footprint $footprint = null): JsonResponse { 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", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/location/{id}", name="tree_location") - * @Route("/locations", name="tree_location_root") - */ + #[Route(path: '/location/{id}', name: 'tree_location')] + #[Route(path: '/locations', name: 'tree_location_root')] public function locationTree(?Storelocation $location = null): JsonResponse { 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", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/manufacturer/{id}", name="tree_manufacturer") - * @Route("/manufacturers", name="tree_manufacturer_root") - */ + #[Route(path: '/manufacturer/{id}', name: 'tree_manufacturer')] + #[Route(path: '/manufacturers', name: 'tree_manufacturer_root')] public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse { 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", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/supplier/{id}", name="tree_supplier") - * @Route("/suppliers", name="tree_supplier_root") - */ + #[Route(path: '/supplier/{id}', name: 'tree_supplier')] + #[Route(path: '/suppliers', name: 'tree_supplier_root')] public function supplierTree(?Supplier $supplier = null): JsonResponse { 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", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/device/{id}", name="tree_device") - * @Route("/devices", name="tree_device_root") - */ + #[Route(path: '/device/{id}', name: 'tree_device')] + #[Route(path: '/devices', name: 'tree_device_root')] public function deviceTree(?Project $device = null): JsonResponse { if ($this->isGranted('@projects.read')) { $tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index c5d440d2..19385d0f 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -51,9 +51,8 @@ use Symfony\Component\Serializer\Serializer; /** * In this controller the endpoints for the typeaheads are collected. - * - * @Route("/typeahead") */ +#[Route(path: '/typeahead')] class TypeaheadController extends AbstractController { protected AttachmentURLGenerator $urlGenerator; @@ -65,9 +64,7 @@ class TypeaheadController extends AbstractController $this->assets = $assets; } - /** - * @Route("/builtInResources/search", name="typeahead_builtInRessources") - */ + #[Route(path: '/builtInResources/search', name: 'typeahead_builtInRessources')] public function builtInResources(Request $request, BuiltinAttachmentsFinder $finder): JsonResponse { $query = $request->get('query'); @@ -91,7 +88,7 @@ class TypeaheadController extends AbstractController $serializer = new Serializer($normalizers, $encoders); $data = $serializer->serialize($result, 'json'); - return new JsonResponse($data, 200, [], true); + return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true); } /** @@ -131,11 +128,11 @@ class TypeaheadController extends AbstractController } /** - * @Route("/parts/search/{query}", name="typeahead_parts") * @param string $query * @param EntityManagerInterface $entityManager * @return JsonResponse */ + #[Route(path: '/parts/search/{query}', name: 'typeahead_parts')] public function parts(EntityManagerInterface $entityManager, PartPreviewGenerator $previewGenerator, AttachmentURLGenerator $attachmentURLGenerator, string $query = ""): JsonResponse { @@ -170,10 +167,10 @@ class TypeaheadController extends AbstractController } /** - * @Route("/parameters/{type}/search/{query}", name="typeahead_parameters", requirements={"type" = ".+"}) * @param string $query * @return JsonResponse */ + #[Route(path: '/parameters/{type}/search/{query}', name: 'typeahead_parameters', requirements: ['type' => '.+'])] public function parameters(string $type, EntityManagerInterface $entityManager, string $query = ""): JsonResponse { $class = $this->typeToParameterClass($type); @@ -190,9 +187,7 @@ class TypeaheadController extends AbstractController return new JsonResponse($data); } - /** - * @Route("/tags/search/{query}", name="typeahead_tags", requirements={"query"= ".+"}) - */ + #[Route(path: '/tags/search/{query}', name: 'typeahead_tags', requirements: ['query' => '.+'])] public function tags(string $query, TagFinder $finder): JsonResponse { $this->denyAccessUnlessGranted('@parts.read'); @@ -209,6 +204,6 @@ class TypeaheadController extends AbstractController $serializer = new Serializer($normalizers, $encoders); $data = $serializer->serialize($array, 'json'); - return new JsonResponse($data, 200, [], true); + return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true); } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 9669a3a6..7d2b8160 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -46,10 +46,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/user") - * Class UserController - */ +#[Route(path: '/user')] class UserController extends AdminPages\BaseAdminController { protected string $entity_class = User::class; @@ -76,11 +73,11 @@ class UserController extends AdminPages\BaseAdminController } /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="user_edit") - * @Route("/{id}/", requirements={"id"="\d+"}) * * @throws Exception */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'user_edit')] + #[Route(path: '/{id}/', requirements: ['id' => '\d+'])] public function edit(User $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response { //Do an upgrade of the permission schema if needed (so the user can see the permissions a user get on next request (even if it was not done yet) @@ -148,19 +145,15 @@ class UserController extends AdminPages\BaseAdminController return true; } - /** - * @Route("/new", name="user_new") - * @Route("/{id}/clone", name="user_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'user_new')] + #[Route(path: '/{id}/clone', name: 'user_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/{id}", name="user_delete", methods={"DELETE"}, requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}', name: 'user_delete', methods: ['DELETE'], requirements: ['id' => '\d+'])] public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { if (User::ID_ANONYMOUS === $entity->getID()) { @@ -170,26 +163,20 @@ class UserController extends AdminPages\BaseAdminController return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/export", name="user_export_all") - */ + #[Route(path: '/export', name: 'user_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="user_export") - */ + #[Route(path: '/{id}/export', name: 'user_export')] public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); } - /** - * @Route("/info", name="user_info_self") - * @Route("/{id}/info", name="user_info") - */ + #[Route(path: '/info', name: 'user_info_self')] + #[Route(path: '/{id}/info', name: 'user_info')] 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 @@ -229,7 +216,7 @@ class UserController extends AdminPages\BaseAdminController 'data' => $user, ]); - return $this->renderForm('users/user_info.html.twig', [ + return $this->render('users/user_info.html.twig', [ 'user' => $user, 'form' => $builder->getForm(), 'datatable' => $table ?? null, diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php index c1c38d6b..298b94d0 100644 --- a/src/Controller/UserSettingsController.php +++ b/src/Controller/UserSettingsController.php @@ -51,9 +51,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Validator\Constraints\Length; -/** - * @Route("/user") - */ +#[Route(path: '/user')] class UserSettingsController extends AbstractController { protected bool $demo_mode; @@ -69,9 +67,7 @@ class UserSettingsController extends AbstractController $this->eventDispatcher = $eventDispatcher; } - /** - * @Route("/2fa_backup_codes", name="show_backup_codes") - */ + #[Route(path: '/2fa_backup_codes', name: 'show_backup_codes')] public function showBackupCodes() { $user = $this->getUser(); @@ -98,9 +94,7 @@ class UserSettingsController extends AbstractController ]); } - /** - * @Route("/u2f_delete", name="u2f_delete", methods={"DELETE"}) - */ + #[Route(path: '/u2f_delete', name: 'u2f_delete', methods: ['DELETE'])] public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse { if ($this->demo_mode) { @@ -181,10 +175,9 @@ class UserSettingsController extends AbstractController } /** - * @Route("/invalidate_trustedDevices", name="tfa_trustedDevices_invalidate", methods={"DELETE"}) - * * @return RuntimeException|RedirectResponse */ + #[Route(path: '/invalidate_trustedDevices', name: 'tfa_trustedDevices_invalidate', methods: ['DELETE'])] public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager) { if ($this->demo_mode) { @@ -219,10 +212,9 @@ class UserSettingsController extends AbstractController } /** - * @Route("/settings", name="user_settings") - * * @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) { /** @var User $user */ @@ -397,7 +389,7 @@ class UserSettingsController extends AbstractController * Output both forms *****************************/ - return $this->renderForm('users/user_settings.html.twig', [ + return $this->render('users/user_settings.html.twig', [ 'user' => $user, 'settings_form' => $form, 'pw_form' => $pw_form, diff --git a/src/Controller/WebauthnKeyRegistrationController.php b/src/Controller/WebauthnKeyRegistrationController.php index 8a26346a..ee39954a 100644 --- a/src/Controller/WebauthnKeyRegistrationController.php +++ b/src/Controller/WebauthnKeyRegistrationController.php @@ -40,9 +40,7 @@ class WebauthnKeyRegistrationController extends AbstractController $this->demo_mode = $demo_mode; } - /** - * @Route("/webauthn/register", name="webauthn_register") - */ + #[Route(path: '/webauthn/register', name: 'webauthn_register')] public function register(Request $request, TFAWebauthnRegistrationHelper $registrationHelper, EntityManagerInterface $em) { //When user change its settings, he should be logged in fully. diff --git a/src/DataTables/Column/RevertLogColumn.php b/src/DataTables/Column/RevertLogColumn.php index 16f3365a..0215bd24 100644 --- a/src/DataTables/Column/RevertLogColumn.php +++ b/src/DataTables/Column/RevertLogColumn.php @@ -52,9 +52,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class RevertLogColumn extends AbstractColumn { protected TranslatorInterface $translator; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(TranslatorInterface $translator, Security $security) + public function __construct(TranslatorInterface $translator, \Symfony\Bundle\SecurityBundle\Security $security) { $this->translator = $translator; $this->security = $security; diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php index bef88955..424297e0 100644 --- a/src/DataTables/LogDataTable.php +++ b/src/DataTables/LogDataTable.php @@ -66,13 +66,13 @@ class LogDataTable implements DataTableTypeInterface protected UrlGeneratorInterface $urlGenerator; protected EntityURLGenerator $entityURLGenerator; protected LogEntryRepository $logRepo; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected UserAvatarHelper $userAvatarHelper; protected LogLevelHelper $logLevelHelper; public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, - Security $security, UserAvatarHelper $userAvatarHelper, LogLevelHelper $logLevelHelper) + \Symfony\Bundle\SecurityBundle\Security $security, UserAvatarHelper $userAvatarHelper, LogLevelHelper $logLevelHelper) { $this->elementTypeNameGenerator = $elementTypeNameGenerator; $this->translator = $translator; diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 8dc94ba0..8436cd89 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -56,14 +56,14 @@ final class PartsDataTable implements DataTableTypeInterface { private TranslatorInterface $translator; private AmountFormatter $amountFormatter; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private PartDataTableHelper $partDataTableHelper; private EntityURLGenerator $urlGenerator; public function __construct(EntityURLGenerator $urlGenerator, TranslatorInterface $translator, - AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, Security $security) + AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, \Symfony\Bundle\SecurityBundle\Security $security) { $this->urlGenerator = $urlGenerator; $this->translator = $translator; diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 39b755ce..d33f3a30 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -99,9 +99,9 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var string the name of this element * @ORM\Column(type="string") - * @Assert\NotBlank(message="validator.attachment.name_not_blank") - * @Groups({"simple", "extended", "full"}) */ + #[Assert\NotBlank(message: 'validator.attachment.name_not_blank')] + #[Groups(['simple', 'extended', 'full'])] protected string $name = ''; /** @@ -120,8 +120,8 @@ abstract class Attachment extends AbstractNamedDBElement * @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type") * @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false) * @Selectable() - * @Assert\NotNull(message="validator.attachment.must_not_be_null") */ + #[Assert\NotNull(message: 'validator.attachment.must_not_be_null')] protected ?AttachmentType $attachment_type = null; public function __construct() diff --git a/src/Entity/Attachments/AttachmentContainingDBElement.php b/src/Entity/Attachments/AttachmentContainingDBElement.php index e74d7cb6..5f592ed2 100644 --- a/src/Entity/Attachments/AttachmentContainingDBElement.php +++ b/src/Entity/Attachments/AttachmentContainingDBElement.php @@ -44,8 +44,8 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl * //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element") * * Mapping is done in sub classes like part - * @Groups({"full"}) */ + #[Groups(['full'])] protected Collection $attachments; public function __construct() diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index 683c7be5..a7e3742f 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -63,15 +63,15 @@ class AttachmentType extends AbstractStructuralDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php index 8cc3e5d6..8b29d8a1 100644 --- a/src/Entity/Attachments/AttachmentTypeAttachment.php +++ b/src/Entity/Attachments/AttachmentTypeAttachment.php @@ -29,8 +29,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to an attachmentType element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class AttachmentTypeAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php index bfc54af0..49685f15 100644 --- a/src/Entity/Attachments/CategoryAttachment.php +++ b/src/Entity/Attachments/CategoryAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a category element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class CategoryAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Category::class; diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php index ebfef170..caa595f6 100644 --- a/src/Entity/Attachments/CurrencyAttachment.php +++ b/src/Entity/Attachments/CurrencyAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a currency element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class CurrencyAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Currency::class; diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php index 7eb65db1..5bca593b 100644 --- a/src/Entity/Attachments/FootprintAttachment.php +++ b/src/Entity/Attachments/FootprintAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a footprint element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class FootprintAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Footprint::class; diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php index b6ab93f4..b48ca523 100644 --- a/src/Entity/Attachments/GroupAttachment.php +++ b/src/Entity/Attachments/GroupAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a Group element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class GroupAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Group::class; diff --git a/src/Entity/Attachments/LabelAttachment.php b/src/Entity/Attachments/LabelAttachment.php index f0f70b79..a8c09bee 100644 --- a/src/Entity/Attachments/LabelAttachment.php +++ b/src/Entity/Attachments/LabelAttachment.php @@ -49,8 +49,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a user element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class LabelAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = LabelProfile::class; diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php index 25451b7c..ca11d0b3 100644 --- a/src/Entity/Attachments/ManufacturerAttachment.php +++ b/src/Entity/Attachments/ManufacturerAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a manufacturer element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class ManufacturerAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php index 8a007101..623e0661 100644 --- a/src/Entity/Attachments/MeasurementUnitAttachment.php +++ b/src/Entity/Attachments/MeasurementUnitAttachment.php @@ -31,8 +31,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a measurement unit element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class MeasurementUnitAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php index 3aa2d05c..2efb0088 100644 --- a/src/Entity/Attachments/PartAttachment.php +++ b/src/Entity/Attachments/PartAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a part element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class PartAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Part::class; diff --git a/src/Entity/Attachments/ProjectAttachment.php b/src/Entity/Attachments/ProjectAttachment.php index 3f2d36d9..f9d3d24e 100644 --- a/src/Entity/Attachments/ProjectAttachment.php +++ b/src/Entity/Attachments/ProjectAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a device element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class ProjectAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Project::class; diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php index 71e5672e..95e0136d 100644 --- a/src/Entity/Attachments/StorelocationAttachment.php +++ b/src/Entity/Attachments/StorelocationAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a measurement unit element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class StorelocationAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Storelocation::class; diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php index a6058ccc..fffa2e5b 100644 --- a/src/Entity/Attachments/SupplierAttachment.php +++ b/src/Entity/Attachments/SupplierAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a supplier element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class SupplierAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Supplier::class; diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php index 65cd8730..67998d8e 100644 --- a/src/Entity/Attachments/UserAttachment.php +++ b/src/Entity/Attachments/UserAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a user element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class UserAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = User::class; diff --git a/src/Entity/Base/AbstractCompany.php b/src/Entity/Base/AbstractCompany.php index af77106f..87acface 100644 --- a/src/Entity/Base/AbstractCompany.php +++ b/src/Entity/Base/AbstractCompany.php @@ -37,38 +37,38 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement /** * @var string The address of the company * @ORM\Column(type="string") - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $address = ''; /** * @var string The phone number of the company * @ORM\Column(type="string") - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $phone_number = ''; /** * @var string The fax number of the company * @ORM\Column(type="string") - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $fax_number = ''; /** * @var string The email address of the company * @ORM\Column(type="string") - * @Assert\Email() - * @Groups({"full"}) */ + #[Assert\Email] + #[Groups(['full'])] protected string $email_address = ''; /** * @var string The website of the company * @ORM\Column(type="string") - * @Assert\Url() - * @Groups({"full"}) */ + #[Assert\Url] + #[Groups(['full'])] protected string $website = ''; /** diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index 97b77d53..e2946f4e 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -36,41 +36,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * must have the table row "id"!! The ID is the unique key to identify the elements. * * @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "attachment_type" = "App\Entity\Attachments\AttachmentType", - * "attachment" = "App\Entity\Attachments\Attachment", - * "attachment_type_attachment" = "App\Entity\Attachments\AttachmentTypeAttachment", - * "category_attachment" = "App\Entity\Attachments\CategoryAttachment", - * "currency_attachment" = "App\Entity\Attachments\CurrencyAttachment", - * "footprint_attachment" = "App\Entity\Attachments\FootprintAttachment", - * "group_attachment" = "App\Entity\Attachments\GroupAttachment", - * "label_attachment" = "App\Entity\Attachments\LabelAttachment", - * "manufacturer_attachment" = "App\Entity\Attachments\ManufacturerAttachment", - * "measurement_unit_attachment" = "App\Entity\Attachments\MeasurementUnitAttachment", - * "part_attachment" = "App\Entity\Attachments\PartAttachment", - * "project_attachment" = "App\Entity\Attachments\ProjectAttachment", - * "storelocation_attachment" = "App\Entity\Attachments\StorelocationAttachment", - * "supplier_attachment" = "App\Entity\Attachments\SupplierAttachment", - * "user_attachment" = "App\Entity\Attachments\UserAttachment", - * "category" = "App\Entity\Parts\Category", - * "project" = "App\Entity\ProjectSystem\Project", - * "project_bom_entry" = "App\Entity\ProjectSystem\ProjectBOMEntry", - * "footprint" = "App\Entity\Parts\Footprint", - * "group" = "App\Entity\UserSystem\Group", - * "manufacturer" = "App\Entity\Parts\Manufacturer", - * "orderdetail" = "App\Entity\PriceInformations\Orderdetail", - * "part" = "App\Entity\Parts\Part", - * "pricedetail" = "App\Entity\PriceInformation\Pricedetail", - * "storelocation" = "App\Entity\Parts\Storelocation", - * "part_lot" = "App\Entity\Parts\PartLot", - * "currency" = "App\Entity\PriceInformations\Currency", - * "measurement_unit" = "App\Entity\Parts\MeasurementUnit", - * "parameter" = "App\Entity\Parts\AbstractParameter", - * "supplier" = "App\Entity\Parts\Supplier", - * "user" = "App\Entity\UserSystem\User" - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => 'App\Entity\Attachments\AttachmentType', 'attachment' => 'App\Entity\Attachments\Attachment', 'attachment_type_attachment' => 'App\Entity\Attachments\AttachmentTypeAttachment', 'category_attachment' => 'App\Entity\Attachments\CategoryAttachment', 'currency_attachment' => 'App\Entity\Attachments\CurrencyAttachment', 'footprint_attachment' => 'App\Entity\Attachments\FootprintAttachment', 'group_attachment' => 'App\Entity\Attachments\GroupAttachment', 'label_attachment' => 'App\Entity\Attachments\LabelAttachment', 'manufacturer_attachment' => 'App\Entity\Attachments\ManufacturerAttachment', 'measurement_unit_attachment' => 'App\Entity\Attachments\MeasurementUnitAttachment', 'part_attachment' => 'App\Entity\Attachments\PartAttachment', 'project_attachment' => 'App\Entity\Attachments\ProjectAttachment', 'storelocation_attachment' => 'App\Entity\Attachments\StorelocationAttachment', 'supplier_attachment' => 'App\Entity\Attachments\SupplierAttachment', 'user_attachment' => 'App\Entity\Attachments\UserAttachment', 'category' => 'App\Entity\Parts\Category', 'project' => 'App\Entity\ProjectSystem\Project', 'project_bom_entry' => 'App\Entity\ProjectSystem\ProjectBOMEntry', 'footprint' => 'App\Entity\Parts\Footprint', 'group' => 'App\Entity\UserSystem\Group', 'manufacturer' => 'App\Entity\Parts\Manufacturer', 'orderdetail' => 'App\Entity\PriceInformations\Orderdetail', 'part' => 'App\Entity\Parts\Part', 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => 'App\Entity\Parts\Storelocation', 'part_lot' => 'App\Entity\Parts\PartLot', 'currency' => 'App\Entity\PriceInformations\Currency', 'measurement_unit' => 'App\Entity\Parts\MeasurementUnit', 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => 'App\Entity\Parts\Supplier', 'user' => 'App\Entity\UserSystem\User'])] abstract class AbstractDBElement implements JsonSerializable { /** @var int|null The Identification number for this part. This value is unique for the element in this table. @@ -78,8 +45,8 @@ abstract class AbstractDBElement implements JsonSerializable * @ORM\Column(type="integer") * @ORM\Id() * @ORM\GeneratedValue() - * @Groups({"full"}) */ + #[Groups(['full'])] protected ?int $id = null; public function __clone() diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php index ddb758c0..90ebc91c 100644 --- a/src/Entity/Base/AbstractNamedDBElement.php +++ b/src/Entity/Base/AbstractNamedDBElement.php @@ -41,9 +41,9 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named /** * @var string the name of this element * @ORM\Column(type="string") - * @Assert\NotBlank() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\NotBlank] + #[Groups(['simple', 'extended', 'full', 'import'])] protected string $name = ''; /****************************************************************************** diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index 52326907..a4a047ef 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -33,6 +33,6 @@ use Symfony\Component\Serializer\Annotation\Groups; */ abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement { - /** @Groups({"full"}) */ + #[Groups(['full'])] protected Collection $parameters; } diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 1353448d..8ce54f0e 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -46,9 +46,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository") * * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - * - * @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name") */ +#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')] abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement { use ParametersTrait; @@ -63,16 +62,16 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement /** * @var string The comment info for this element * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $comment = ''; /** * @var bool If this property is set, this element can not be selected for part properties. * Useful if this element should be used only for grouping, sorting. * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $not_selectable = false; /** @@ -85,15 +84,15 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement * subclasses. * * @var AbstractStructuralDBElement[]|Collection - * @Groups({"include_children"}) */ + #[Groups(['include_children'])] protected Collection $children; /** * @var AbstractStructuralDBElement * @NoneOfItsChildren() - * @Groups({"include_parents", "import"}) */ + #[Groups(['include_parents', 'import'])] protected ?AbstractStructuralDBElement $parent = null; /** @var string[] all names of all parent elements as an array of strings, diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php index b6c5657f..b5e0f29a 100644 --- a/src/Entity/Base/MasterAttachmentTrait.php +++ b/src/Entity/Base/MasterAttachmentTrait.php @@ -35,8 +35,8 @@ trait MasterAttachmentTrait * @var Attachment|null * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") * @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) - * @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture") */ + #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] protected ?Attachment $master_picture_attachment = null; /** diff --git a/src/Entity/Base/TimestampTrait.php b/src/Entity/Base/TimestampTrait.php index df3779eb..c4c74255 100644 --- a/src/Entity/Base/TimestampTrait.php +++ b/src/Entity/Base/TimestampTrait.php @@ -34,15 +34,15 @@ trait TimestampTrait /** * @var DateTime|null the date when this element was modified the last time * @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"}) - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected ?DateTime $lastModified = null; /** * @var DateTime|null the date when this element was created * @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"}) - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected ?DateTime $addedDate = null; /** diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index f3f448ad..913aa5b3 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -57,37 +57,37 @@ class LabelOptions /** * @var float The page size of the label in mm - * @Assert\Positive() * @ORM\Column(type="float") */ + #[Assert\Positive] protected float $width = 50.0; /** * @var float The page size of the label in mm - * @Assert\Positive() * @ORM\Column(type="float") */ + #[Assert\Positive] 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="string") */ + #[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)] protected string $barcode_type = 'none'; /** * @var string What image should be shown along the - * @Assert\Choice(choices=LabelOptions::PICTURE_TYPES) * @ORM\Column(type="string") */ + #[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)] protected string $picture_type = 'none'; /** * @var string - * @Assert\Choice(choices=LabelOptions::SUPPORTED_ELEMENTS) * @ORM\Column(type="string") */ + #[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)] protected string $supported_element = 'part'; /** @@ -97,9 +97,9 @@ class LabelOptions 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="string") */ + #[Assert\Choice(choices: LabelOptions::LINES_MODES)] protected string $lines_mode = 'html'; /** diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php index 12f6d659..ccd4087b 100644 --- a/src/Entity/LabelSystem/LabelProfile.php +++ b/src/Entity/LabelSystem/LabelProfile.php @@ -52,8 +52,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository") * @ORM\Table(name="label_profiles") * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - * @UniqueEntity({"name", "options.supported_element"}) */ +#[UniqueEntity(['name', 'options.supported_element'])] class LabelProfile extends AttachmentContainingDBElement { /** @@ -66,8 +66,8 @@ class LabelProfile extends AttachmentContainingDBElement /** * @var LabelOptions * @ORM\Embedded(class="LabelOptions") - * @Assert\Valid() */ + #[Assert\Valid] protected LabelOptions $options; /** diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 9281970c..134d44aa 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -83,59 +83,59 @@ abstract class AbstractParameter extends AbstractNamedDBElement /** * @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short - * @Assert\Length(max=20) * @ORM\Column(type="string", nullable=false) - * @Groups({"full"}) */ + #[Assert\Length(max: 20)] + #[Groups(['full'])] protected string $symbol = ''; /** * @var float|null the guaranteed minimum value of this property - * @Assert\Type({"float","null"}) - * @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical") - * @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max") * @ORM\Column(type="float", nullable=true) - * @Groups({"full"}) */ + #[Assert\Type(['float', null])] + #[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')] + #[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')] + #[Groups(['full'])] protected ?float $value_min = null; /** * @var float|null the typical value of this property - * @Assert\Type({"null", "float"}) * @ORM\Column(type="float", nullable=true) - * @Groups({"full"}) */ + #[Assert\Type([null, 'float'])] + #[Groups(['full'])] protected ?float $value_typical = null; /** * @var float|null the maximum value of this property - * @Assert\Type({"float", "null"}) - * @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical") * @ORM\Column(type="float", nullable=true) - * @Groups({"full"}) */ + #[Assert\Type(['float', null])] + #[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')] + #[Groups(['full'])] protected ?float $value_max = null; /** * @var string The unit in which the value values are given (e.g. V) * @ORM\Column(type="string", nullable=false) - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $unit = ''; /** * @var string a text value for the given property * @ORM\Column(type="string", nullable=false) - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $value_text = ''; /** * @var string the group this parameter belongs to * @ORM\Column(type="string", nullable=false, name="param_group") - * @Groups({"full"}) - * @Groups({"full"}) */ + #[Groups(['full'])] + #[Groups(['full'])] protected string $group = ''; /** diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php index 8a161883..12b05ae7 100644 --- a/src/Entity/Parameters/AttachmentTypeParameter.php +++ b/src/Entity/Parameters/AttachmentTypeParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class AttachmentTypeParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php index cce90a86..c80004a0 100644 --- a/src/Entity/Parameters/CategoryParameter.php +++ b/src/Entity/Parameters/CategoryParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class CategoryParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Category::class; diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php index cb5fad26..a9f1133e 100644 --- a/src/Entity/Parameters/CurrencyParameter.php +++ b/src/Entity/Parameters/CurrencyParameter.php @@ -50,8 +50,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a category element. * * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class CurrencyParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Currency::class; diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php index cb1dd185..be65d737 100644 --- a/src/Entity/Parameters/FootprintParameter.php +++ b/src/Entity/Parameters/FootprintParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class FootprintParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Footprint::class; diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php index 81a0d39c..c283e142 100644 --- a/src/Entity/Parameters/GroupParameter.php +++ b/src/Entity/Parameters/GroupParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class GroupParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Group::class; diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php index 56d785f2..fd990dd2 100644 --- a/src/Entity/Parameters/ManufacturerParameter.php +++ b/src/Entity/Parameters/ManufacturerParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class ManufacturerParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php index e4980431..2dbc94f8 100644 --- a/src/Entity/Parameters/MeasurementUnitParameter.php +++ b/src/Entity/Parameters/MeasurementUnitParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class MeasurementUnitParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; diff --git a/src/Entity/Parameters/ParametersTrait.php b/src/Entity/Parameters/ParametersTrait.php index f8ac8e78..44cbe664 100644 --- a/src/Entity/Parameters/ParametersTrait.php +++ b/src/Entity/Parameters/ParametersTrait.php @@ -50,8 +50,8 @@ trait ParametersTrait * Mapping done in subclasses. * * @var Collection - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index a3845e55..11798919 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class PartParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Part::class; diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php index d4f8cd1a..362cde04 100644 --- a/src/Entity/Parameters/ProjectParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class ProjectParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Project::class; diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php index 6c7d430b..6b792588 100644 --- a/src/Entity/Parameters/StorelocationParameter.php +++ b/src/Entity/Parameters/StorelocationParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class StorelocationParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Storelocation::class; diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php index 6acac705..3281a722 100644 --- a/src/Entity/Parameters/SupplierParameter.php +++ b/src/Entity/Parameters/SupplierParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class SupplierParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Supplier::class; diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 8a79d871..990a7a1e 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -58,74 +58,74 @@ class Category extends AbstractPartsContainingDBElement /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $partname_hint = ''; /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $partname_regex = ''; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_footprints = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_manufacturers = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_autodatasheets = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_properties = false; /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $default_description = ''; /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $default_comment = ''; /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $parameters; public function getPartnameHint(): string diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index 09a4f4d0..2949d6a8 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -57,8 +57,8 @@ class Footprint extends AbstractPartsContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @@ -71,8 +71,8 @@ class Footprint extends AbstractPartsContainingDBElement /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /**************************************** diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 74d0e308..7e8f75b1 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -57,14 +57,14 @@ class Manufacturer extends AbstractCompany * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; } diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index b33d47fc..10bfc90d 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -40,34 +40,34 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Index(name="unit_idx_name", columns={"name"}), * @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}), * }) - * @UniqueEntity("unit") */ +#[UniqueEntity('unit')] class MeasurementUnit extends AbstractPartsContainingDBElement { /** * @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams) * or m (for meters). * @ORM\Column(type="string", name="unit", nullable=true) - * @Assert\Length(max=10) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Length(max: 10)] + #[Groups(['extended', 'full', 'import'])] protected ?string $unit = null; /** * @var bool Determines if the amount value associated with this unit should be treated as integer. * Set to false, to measure continuous sizes likes masses or lengths. * @ORM\Column(type="boolean", name="is_integer") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $is_integer = false; /** * @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.). * Useful for sizes like meters. For this the unit must be set * @ORM\Column(type="boolean", name="use_si_prefix") - * @Assert\Expression("this.isUseSIPrefix() == false or this.getUnit() != null", message="validator.measurement_unit.use_si_prefix_needs_unit") - * @Groups({"full", "import"}) */ + #[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')] + #[Groups(['full', 'import'])] protected bool $use_si_prefix = false; /** @@ -87,15 +87,15 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index d9b7e601..c4e9d00a 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -54,8 +54,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * @ORM\Index(name="parts_idx_name", columns={"name"}), * @ORM\Index(name="parts_idx_ipn", columns={"ipn"}), * }) - * @UniqueEntity(fields={"ipn"}, message="part.ipn.must_be_unique") */ +#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')] class Part extends AttachmentContainingDBElement { use AdvancedPropertyTrait; @@ -68,11 +68,11 @@ class Part extends AttachmentContainingDBElement use ProjectTrait; /** @var Collection - * @Assert\Valid() * @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $parameters; /** @@ -95,9 +95,9 @@ class Part extends AttachmentContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $attachments; /** @@ -110,8 +110,8 @@ class Part extends AttachmentContainingDBElement * @var Attachment|null * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") * @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) - * @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture") */ + #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] protected ?Attachment $master_picture_attachment = null; public function __construct() @@ -150,9 +150,7 @@ class Part extends AttachmentContainingDBElement parent::__clone(); } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { //Ensure that the part name fullfills the regex of the category diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index cd69651f..e8bc4917 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -55,23 +55,23 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * @var string A short description about this lot, shown in table * @ORM\Column(type="text") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected string $description = ''; /** * @var string a comment stored with this lot * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $comment = ''; /** * @var ?DateTime Set a time until when the lot must be used. * Set to null, if the lot can be used indefinitely. * @ORM\Column(type="datetime", name="expiration_date", nullable=true) - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?DateTime $expiration_date = null; /** @@ -79,38 +79,38 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @ORM\ManyToOne(targetEntity="Storelocation") * @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true) * @Selectable() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Storelocation $storage_location = null; /** * @var bool If this is set to true, the instock amount is marked as not known * @ORM\Column(type="boolean") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected bool $instock_unknown = false; /** * @var float For continuous sizes (length, volume, etc.) the instock is saved here. * @ORM\Column(type="float") - * @Assert\PositiveOrZero() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\PositiveOrZero] + #[Groups(['simple', 'extended', 'full', 'import'])] protected float $amount = 0.0; /** * @var bool determines if this lot was manually marked for refilling * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $needs_refill = false; /** * @var Part The part that is stored in this lot * @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots") * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE") - * @Assert\NotNull() */ + #[Assert\NotNull] protected Part $part; /** @@ -338,9 +338,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named return $this->description; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { //Ensure that the owner is not the anonymous user diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index 50935fd3..43c0c57d 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -35,31 +35,31 @@ trait AdvancedPropertyTrait /** * @var bool Determines if this part entry needs review (for example, because it is work in progress) * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $needs_review = false; /** * @var string a comma separated list of tags, associated with the part * @ORM\Column(type="text") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $tags = ''; /** * @var float|null how much a single part unit weighs in grams * @ORM\Column(type="float", nullable=true) - * @Assert\PositiveOrZero() - * @Groups({"extended", "full", "import"}) */ + #[Assert\PositiveOrZero] + #[Groups(['extended', 'full', 'import'])] protected ?float $mass = null; /** * @var string|null The internal part number of the part * @ORM\Column(type="string", length=100, nullable=true, unique=true) - * @Assert\Length(max="100") - * @Groups({"extended", "full", "import"}) */ + #[Assert\Length(max: 100)] + #[Groups(['extended', 'full', 'import'])] protected ?string $ipn = null; /** diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php index f675dc72..6dfc26ec 100644 --- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php @@ -34,15 +34,15 @@ trait BasicPropertyTrait /** * @var string A text describing what this part does * @ORM\Column(type="text") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected string $description = ''; /** * @var string A comment/note related to this part * @ORM\Column(type="text") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $comment = ''; /** @@ -54,8 +54,8 @@ trait BasicPropertyTrait /** * @var bool true, if the part is marked as favorite * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $favorite = false; /** @@ -64,9 +64,9 @@ trait BasicPropertyTrait * @ORM\ManyToOne(targetEntity="Category") * @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false) * @Selectable() - * @Assert\NotNull(message="validator.select_valid_category") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\NotNull(message: 'validator.select_valid_category')] + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Category $category = null; /** @@ -74,8 +74,8 @@ trait BasicPropertyTrait * @ORM\ManyToOne(targetEntity="Footprint") * @ORM\JoinColumn(name="id_footprint", referencedColumnName="id") * @Selectable() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Footprint $footprint = null; /** diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 8ab300b5..cf1da1e0 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -37,27 +37,27 @@ trait InstockTrait /** * @var Collection|PartLot[] A list of part lots where this part is stored * @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() * @ORM\OrderBy({"amount" = "DESC"}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full', 'import'])] protected $partLots; /** * @var float The minimum amount of the part that has to be instock, otherwise more is ordered. * Given in the partUnit. * @ORM\Column(type="float") - * @Assert\PositiveOrZero() - * @Groups({"extended", "full", "import"}) */ + #[Assert\PositiveOrZero] + #[Groups(['extended', 'full', 'import'])] protected float $minamount = 0; /** * @var ?MeasurementUnit the unit in which the part's amount is measured * @ORM\ManyToOne(targetEntity="MeasurementUnit") * @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true) - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?MeasurementUnit $partUnit = null; /** diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php index de4bd940..fea580d0 100644 --- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php +++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php @@ -39,31 +39,31 @@ trait ManufacturerTrait * @ORM\ManyToOne(targetEntity="Manufacturer") * @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id") * @Selectable() - * @Groups({"simple","extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Manufacturer $manufacturer = null; /** * @var string the url to the part on the manufacturer's homepage * @ORM\Column(type="string") - * @Assert\Url() - * @Groups({"full", "import"}) */ + #[Assert\Url] + #[Groups(['full', 'import'])] protected string $manufacturer_product_url = ''; /** * @var string The product number used by the manufacturer. If this is set to "", the name field is used. * @ORM\Column(type="string") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $manufacturer_product_number = ''; /** * @var string|null The production status of this part. Can be one of the specified ones. * @ORM\Column(type="string", length=255, nullable=true) - * @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])] + #[Groups(['extended', 'full', 'import'])] protected ?string $manufacturing_status = ''; /** diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index d92ab762..b2feb024 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -37,10 +37,10 @@ trait OrderTrait /** * @var Orderdetail[]|Collection the details about how and where you can order this part * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() * @ORM\OrderBy({"supplierpartnr" = "ASC"}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full', 'import'])] protected $orderdetails; /** diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index 03c5951f..3f18c79e 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -66,37 +66,37 @@ class Storelocation extends AbstractPartsContainingDBElement /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $is_full = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $only_single_part = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $limit_to_existing_parts = false; /** * @var User|null The owner of this storage location * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User") * @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL") - * @Assert\Expression("this.getOwner() == null or this.getOwner().isAnonymousUser() === false", message="validator.part_lot.owner_must_not_be_anonymous") */ + #[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')] protected ?User $owner = null; /** @@ -108,8 +108,8 @@ class Storelocation extends AbstractPartsContainingDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /******************************************************************************** diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index f8ab4202..95fd25fe 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -76,24 +76,24 @@ class Supplier extends AbstractCompany /** * @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier * @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5) - * @Groups({"extended", "full", "import"}) * @BigDecimalPositiveOrZero() */ + #[Groups(['extended', 'full', 'import'])] protected ?BigDecimal $shipping_costs = null; /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index 6b78de19..ee90cdd3 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -38,13 +38,13 @@ use Symfony\Component\Validator\Constraints as Assert; /** * This entity describes a currency that can be used for price information. * - * @UniqueEntity("iso_code") * @ORM\Entity() * @ORM\Table(name="currencies", indexes={ * @ORM\Index(name="currency_idx_name", columns={"name"}), * @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}), * }) */ +#[UniqueEntity('iso_code')] class Currency extends AbstractStructuralDBElement { public const PRICE_SCALE = 5; @@ -60,9 +60,9 @@ class Currency extends AbstractStructuralDBElement /** * @var string the 3-letter ISO code of the currency * @ORM\Column(type="string") - * @Assert\Currency() - * @Groups({"extended", "full", "import"}) */ + #[Assert\Currency] + #[Groups(['extended', 'full', 'import'])] protected string $iso_code = ""; /** @@ -81,15 +81,15 @@ class Currency extends AbstractStructuralDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** @var Collection diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index c1d182a2..366f9b81 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -45,57 +45,57 @@ use Symfony\Component\Validator\Constraints as Assert; * }) * @ORM\Entity() * @ORM\HasLifecycleCallbacks() - * @UniqueEntity({"supplierpartnr", "supplier", "part"}) */ +#[UniqueEntity(['supplierpartnr', 'supplier', 'part'])] class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface { use TimestampTrait; /** * @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() * @ORM\OrderBy({"min_discount_quantity" = "ASC"}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full', 'import'])] protected Collection $pricedetails; /** * @var string * @ORM\Column(type="string") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $supplierpartnr = ''; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $obsolete = false; /** * @var string * @ORM\Column(type="string") - * @Assert\Url() - * @Groups({"full", "import"}) */ + #[Assert\Url] + #[Groups(['full', 'import'])] protected string $supplier_product_url = ''; /** * @var Part|null * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails") * @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - * @Assert\NotNull() */ + #[Assert\NotNull] protected ?Part $part = null; /** * @var Supplier|null * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails") * @ORM\JoinColumn(name="id_supplier", referencedColumnName="id") - * @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null") - * @Groups({"extended", "full", "import"}) */ + #[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')] + #[Groups(['extended', 'full', 'import'])] protected ?Supplier $supplier = null; public function __construct() diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index 49d01730..b4a0cbc6 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -44,8 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Index(name="pricedetails_idx_min_discount_price_qty", columns={"min_discount_quantity", "price_related_quantity"}), * }) * @ORM\HasLifecycleCallbacks() - * @UniqueEntity(fields={"min_discount_quantity", "orderdetail"}) */ +#[UniqueEntity(fields: ['min_discount_quantity', 'orderdetail'])] class Pricedetail extends AbstractDBElement implements TimeStampableInterface { use TimestampTrait; @@ -56,8 +56,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @var BigDecimal The price related to the detail. (Given in the selected currency) * @ORM\Column(type="big_decimal", precision=11, scale=5) * @BigDecimalPositive() - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected BigDecimal $price; /** @@ -66,24 +66,24 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @ORM\ManyToOne(targetEntity="Currency", inversedBy="pricedetails") * @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true) * @Selectable() - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?Currency $currency = null; /** * @var float * @ORM\Column(type="float") - * @Assert\Positive() - * @Groups({"extended", "full", "import"}) */ + #[Assert\Positive] + #[Groups(['extended', 'full', 'import'])] protected float $price_related_quantity = 1.0; /** * @var float * @ORM\Column(type="float") - * @Assert\Positive() - * @Groups({"extended", "full", "import"}) */ + #[Assert\Positive] + #[Groups(['extended', 'full', 'import'])] protected float $min_discount_quantity = 1.0; /** @@ -96,8 +96,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @var Orderdetail|null * @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails") * @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - * @Assert\NotNull() */ + #[Assert\NotNull] protected ?Orderdetail $orderdetail = null; public function __construct() diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index ce55b50a..13bc4832 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -57,9 +57,9 @@ class Project extends AbstractStructuralDBElement /** * @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() - * @Groups({"extended", "full"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full'])] protected Collection $bom_entries; /** @@ -70,9 +70,9 @@ class Project extends AbstractStructuralDBElement /** * @var string|null The current status of the project * @ORM\Column(type="string", length=64, nullable=true) - * @Assert\Choice({"draft","planning","in_production","finished","archived"}) - * @Groups({"extended", "full"}) */ + #[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])] + #[Groups(['extended', 'full'])] protected ?string $status = null; @@ -89,8 +89,8 @@ class Project extends AbstractStructuralDBElement /** * @ORM\Column(type="text", nullable=false) - * @Groups({"simple", "extended", "full"}) */ + #[Groups(['simple', 'extended', 'full'])] protected string $description = ''; /** @@ -286,9 +286,7 @@ class Project extends AbstractStructuralDBElement } } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { //If this project has subprojects, and these have builds part, they must be included in the BOM diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index a14f5f2d..cc8f5fde 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -40,9 +40,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * @ORM\Table("project_bom_entries") * @ORM\HasLifecycleCallbacks() * @ORM\Entity() - * @UniqueEntity(fields={"part", "project"}, message="project.bom_entry.part_already_in_bom") - * @UniqueEntity(fields={"name", "project"}, message="project.bom_entry.name_already_in_bom", ignoreNull=true) */ +#[UniqueEntity(fields: ['part', 'project'], message: 'project.bom_entry.part_already_in_bom')] +#[UniqueEntity(fields: ['name', 'project'], message: 'project.bom_entry.name_already_in_bom', ignoreNull: true)] class ProjectBOMEntry extends AbstractDBElement { use TimestampTrait; @@ -50,8 +50,8 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var float * @ORM\Column(type="float", name="quantity") - * @Assert\Positive() */ + #[Assert\Positive] protected float $quantity; /** @@ -63,11 +63,8 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var string|null An optional name describing this BOM entry (useful for non-part entries) * @ORM\Column(type="string", nullable=true) - * @Assert\Expression( - * "this.getPart() !== null or this.getName() !== null", - * message="validator.project.bom_entry.name_or_part_needed" - * ) */ + #[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')] protected ?string $name = null; /** @@ -93,11 +90,8 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var BigDecimal|null The price of this non-part BOM entry * @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true) - * @Assert\AtLeastOneOf({ - * @BigDecimalPositive(), - * @Assert\IsNull() - * }) */ + #[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])] protected ?BigDecimal $price; /** @@ -269,9 +263,7 @@ class ProjectBOMEntry extends AbstractDBElement return $this->part !== null; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload): void { //Round quantity to whole numbers, if the part is not a decimal part diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 74a600fe..05c2b205 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -66,30 +66,30 @@ 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 * @ORM\Column(type="boolean", name="enforce_2fa") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $enforce2FA = false; /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** * @var PermissionData|null * @ValidPermission() * @ORM\Embedded(class="PermissionData", columnPrefix="permissions_") - * @Groups({"full"}) */ + #[Groups(['full'])] protected ?PermissionData $permissions = null; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; public function __construct() diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index eba234c4..6dc06455 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -60,8 +60,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface * @ORM\Index(name="user_idx_username", columns={"name"}) * }) * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - * @UniqueEntity("name", message="validator.user.username_already_used") */ +#[UniqueEntity('name', message: 'validator.user.username_already_used')] class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface { @@ -75,16 +75,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var bool Determines if the user is disabled (user can not log in) * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $disabled = false; /** * @var string|null The theme * @ORM\Column(type="string", name="config_theme", nullable=true) * @ValidTheme() - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected ?string $theme = null; /** @@ -106,8 +106,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string A self-description of the user * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $aboutMe = ''; /** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once. @@ -134,8 +134,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @ORM\ManyToOne(targetEntity="Group", inversedBy="users") * @ORM\JoinColumn(name="group_id", referencedColumnName="id") * @Selectable() - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?Group $group = null; /** @@ -147,25 +147,25 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string|null The timezone the user prefers * @ORM\Column(type="string", name="config_timezone", nullable=true) - * @Assert\Timezone() - * @Groups({"full", "import"}) */ + #[Assert\Timezone] + #[Groups(['full', 'import'])] protected ?string $timezone = ''; /** * @var string|null The language/locale the user prefers * @ORM\Column(type="string", name="config_language", nullable=true) - * @Assert\Language() - * @Groups({"full", "import"}) */ + #[Assert\Language] + #[Groups(['full', 'import'])] protected ?string $language = ''; /** * @var string|null The email address of the user * @ORM\Column(type="string", length=255, nullable=true) - * @Assert\Email() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\Email] + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $email = ''; /** @@ -177,29 +177,29 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string|null The department the user is working * @ORM\Column(type="string", length=255, nullable=true) - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $department = ''; /** * @var string|null The last name of the User * @ORM\Column(type="string", length=255, nullable=true) - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $last_name = ''; /** * @var string|null The first name of the User * @ORM\Column(type="string", length=255, nullable=true) - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $first_name = ''; /** * @var bool True if the user needs to change password after log in * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $need_pw_change = true; /** @@ -210,9 +210,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @ORM\Column(type="string", length=180, unique=true) - * @Assert\NotBlank - * @Assert\Regex("/^[\w\.\+\-\$]+$/", message="user.invalid_username") */ + #[Assert\NotBlank] + #[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')] protected string $name = ''; /** @@ -230,8 +230,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** @var DateTime|null The time when the backup codes were generated * @ORM\Column(type="datetime", nullable=true) - * @Groups({"full"}) */ + #[Groups(['full'])] protected ?DateTime $backupCodesGenerationDate = null; /** @var Collection @@ -253,16 +253,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency") * @ORM\JoinColumn(name="currency_id", referencedColumnName="id") * @Selectable() - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?Currency $currency; /** * @var PermissionData|null * @ValidPermission() * @ORM\Embedded(class="PermissionData", columnPrefix="permissions_") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?PermissionData $permissions = null; /** @@ -274,8 +274,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var bool True if the user was created by a SAML provider (and therefore cannot change its password) * @ORM\Column(type="boolean") - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected bool $saml_user = false; public function __construct() diff --git a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php b/src/EventSubscriber/LogSystem/LogoutLoggerListener.php index 3b197b38..0c4d0ed5 100644 --- a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php +++ b/src/EventSubscriber/LogSystem/LogoutLoggerListener.php @@ -30,7 +30,7 @@ use Symfony\Component\Security\Http\Event\LogoutEvent; /** * This handler logs to event log, if a user logs out. */ -class LogoutLoggerListener +class LogoutLoggerEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface { protected EventLogger $logger; protected bool $gpdr_compliance; @@ -58,4 +58,11 @@ class LogoutLoggerListener $this->logger->logAndFlush($log); } + /** + * @return array + */ + public static function getSubscribedEvents(): array + { + return [\Symfony\Component\Security\Http\Event\LogoutEvent::class => '']; + } } diff --git a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php index a668828c..73708566 100644 --- a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php +++ b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php @@ -36,10 +36,10 @@ use Symfony\Component\Security\Core\Security; */ final class LogoutDisabledUserSubscriber implements EventSubscriberInterface { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private UrlGeneratorInterface $urlGenerator; - public function __construct(Security $security, UrlGeneratorInterface $urlGenerator) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator) { $this->security = $security; diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php index fb12942b..6c7e61f5 100644 --- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php +++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php @@ -55,10 +55,10 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface * @var string The route the user will redirected to, if he needs to change this password */ public const REDIRECT_TARGET = 'user_settings'; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private HttpUtils $httpUtils; - public function __construct(Security $security, HttpUtils $httpUtils) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, HttpUtils $httpUtils) { $this->security = $security; $this->httpUtils = $httpUtils; diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php index c39d4b37..a6347c26 100644 --- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php +++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php @@ -34,9 +34,9 @@ use Symfony\Component\Security\Core\Security; final class SetUserTimezoneSubscriber implements EventSubscriberInterface { private string $default_timezone; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(string $timezone, Security $security) + public function __construct(string $timezone, \Symfony\Bundle\SecurityBundle\Security $security) { $this->default_timezone = $timezone; $this->security = $security; diff --git a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php index 1d03cb83..551bb8b6 100644 --- a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php +++ b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php @@ -35,12 +35,12 @@ use Symfony\Component\Security\Core\Security; */ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private PermissionSchemaUpdater $permissionSchemaUpdater; private EntityManagerInterface $entityManager; private EventCommentHelper $eventCommentHelper; - public function __construct(Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper) { $this->security = $security; $this->permissionSchemaUpdater = $permissionSchemaUpdater; diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php index 57ba6fed..475eb66e 100644 --- a/src/Form/AdminPages/AttachmentTypeAdminForm.php +++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php @@ -34,7 +34,7 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm { protected FileTypeFilterTools $filterTools; - public function __construct(Security $security, FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) { $this->filterTools = $filterTools; parent::__construct($security, $eventCommentNeededHelper); diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php index 31dd39f0..4e49c784 100644 --- a/src/Form/AdminPages/BaseEntityAdminForm.php +++ b/src/Form/AdminPages/BaseEntityAdminForm.php @@ -44,10 +44,10 @@ use Symfony\Component\Security\Core\Security; class BaseEntityAdminForm extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected EventCommentNeededHelper $eventCommentNeededHelper; - public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper) { $this->security = $security; $this->eventCommentNeededHelper = $eventCommentNeededHelper; diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php index 754d7c66..0ba85c49 100644 --- a/src/Form/AdminPages/CurrencyAdminForm.php +++ b/src/Form/AdminPages/CurrencyAdminForm.php @@ -34,7 +34,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm { private string $default_currency; - public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) { parent::__construct($security, $eventCommentNeededHelper); $this->default_currency = $default_currency; diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php index ded1da2f..bc481a82 100644 --- a/src/Form/AdminPages/ImportType.php +++ b/src/Form/AdminPages/ImportType.php @@ -37,9 +37,9 @@ use Symfony\Component\Security\Core\Security; class ImportType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php index 27ee8287..6eb23785 100644 --- a/src/Form/AdminPages/MassCreationForm.php +++ b/src/Form/AdminPages/MassCreationForm.php @@ -32,9 +32,9 @@ use Symfony\Component\Security\Core\Security; class MassCreationForm extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php index db798db8..ea158484 100644 --- a/src/Form/AdminPages/SupplierForm.php +++ b/src/Form/AdminPages/SupplierForm.php @@ -34,7 +34,7 @@ class SupplierForm extends CompanyForm { protected string $default_currency; - public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) { parent::__construct($security, $eventCommentNeededHelper); $this->default_currency = $default_currency; diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 454f34b0..72098dc4 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -52,12 +52,12 @@ class AttachmentFormType extends AbstractType protected UrlGeneratorInterface $urlGenerator; protected bool $allow_attachments_download; protected string $max_file_size; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected AttachmentSubmitHandler $submitHandler; protected TranslatorInterface $translator; public function __construct(AttachmentManager $attachmentHelper, UrlGeneratorInterface $urlGenerator, - Security $security, AttachmentSubmitHandler $submitHandler, TranslatorInterface $translator, + \Symfony\Bundle\SecurityBundle\Security $security, AttachmentSubmitHandler $submitHandler, TranslatorInterface $translator, bool $allow_attachments_downloads, string $max_file_size) { $this->attachment_helper = $attachmentHelper; diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php index 5af69ce6..78546702 100644 --- a/src/Form/LabelOptionsType.php +++ b/src/Form/LabelOptionsType.php @@ -53,9 +53,9 @@ use Symfony\Component\Security\Core\Security; class LabelOptionsType extends AbstractType { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/LabelSystem/LabelDialogType.php b/src/Form/LabelSystem/LabelDialogType.php index 9bc3dfdf..4427fab1 100644 --- a/src/Form/LabelSystem/LabelDialogType.php +++ b/src/Form/LabelSystem/LabelDialogType.php @@ -52,9 +52,9 @@ use Symfony\Component\Security\Core\Security; class LabelDialogType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php index ece78af5..b904e582 100644 --- a/src/Form/Part/OrderdetailType.php +++ b/src/Form/Part/OrderdetailType.php @@ -40,9 +40,9 @@ use Symfony\Component\Security\Core\Security; class OrderdetailType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php index 141b5eca..f00458d2 100644 --- a/src/Form/Part/PartBaseType.php +++ b/src/Form/Part/PartBaseType.php @@ -52,11 +52,11 @@ use Symfony\Component\Security\Core\Security; class PartBaseType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected UrlGeneratorInterface $urlGenerator; protected EventCommentNeededHelper $event_comment_needed_helper; - public function __construct(Security $security, UrlGeneratorInterface $urlGenerator, EventCommentNeededHelper $event_comment_needed_helper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator, EventCommentNeededHelper $event_comment_needed_helper) { $this->security = $security; $this->urlGenerator = $urlGenerator; diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php index 2c46df1a..e0e3f98c 100644 --- a/src/Form/Part/PartLotType.php +++ b/src/Form/Part/PartLotType.php @@ -38,9 +38,9 @@ use Symfony\Component\Security\Core\Security; class PartLotType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Permissions/PermissionsMapper.php b/src/Form/Permissions/PermissionsMapper.php index c08d2954..9ecf09f7 100644 --- a/src/Form/Permissions/PermissionsMapper.php +++ b/src/Form/Permissions/PermissionsMapper.php @@ -52,7 +52,7 @@ final class PermissionsMapper implements DataMapperInterface * @param mixed $viewData View data of the compound form being initialized * @param FormInterface[]|Traversable $forms A list of {@link FormInterface} instances */ - public function mapDataToForms($viewData, $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { foreach ($forms as $form) { if ($this->inherit) { @@ -99,7 +99,7 @@ final class PermissionsMapper implements DataMapperInterface * @param mixed $viewData The compound form's view data that get mapped * its children model data */ - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { if ($this->inherit) { throw new RuntimeException('The permission type is readonly when it is showing read only data!'); diff --git a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php index 606f23f0..f92cf3a9 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php @@ -27,9 +27,4 @@ class ProjectBOMEntryCollectionType extends AbstractType 'label' => false, ]); } - - public function getBlockPrefix(): string - { - return 'project_bom_entry_collection'; - } } \ No newline at end of file diff --git a/src/Form/ProjectSystem/ProjectBOMEntryType.php b/src/Form/ProjectSystem/ProjectBOMEntryType.php index bac8d679..2350f61d 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryType.php @@ -87,10 +87,4 @@ class ProjectBOMEntryType extends AbstractType 'data_class' => ProjectBOMEntry::class, ]); } - - - public function getBlockPrefix(): string - { - return 'project_bom_entry'; - } } \ No newline at end of file diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 3758bb21..206ce3f0 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -38,9 +38,9 @@ use Symfony\Component\Security\Core\Security; class ProjectBuildType extends AbstractType implements DataMapperInterface { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index 08cf688c..c78ce55e 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -117,18 +117,13 @@ class PartSelectType extends AbstractType implements DataMapperInterface ]); } - public function getBlockPrefix(): string - { - return 'part_select'; - } - - public function mapDataToForms($data, $forms) + public function mapDataToForms($data, \Traversable $forms) { $form = current(iterator_to_array($forms, false)); $form->setData($data); } - public function mapFormsToData($forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data) { $form = current(iterator_to_array($forms, false)); $data = $form->getData(); diff --git a/src/Form/Type/RichTextEditorType.php b/src/Form/Type/RichTextEditorType.php index a572fa2e..1d076916 100644 --- a/src/Form/Type/RichTextEditorType.php +++ b/src/Form/Type/RichTextEditorType.php @@ -39,11 +39,6 @@ class RichTextEditorType extends AbstractType } - public function getBlockPrefix(): string - { - return 'rich_text_editor'; - } - public function finishView(FormView $view, FormInterface $form, array $options) { $view->vars['attr'] = array_merge($view->vars['attr'], $this->optionsToAttrArray($options)); diff --git a/src/Form/Type/SIUnitType.php b/src/Form/Type/SIUnitType.php index 0cddb2a1..3f40acc9 100644 --- a/src/Form/Type/SIUnitType.php +++ b/src/Form/Type/SIUnitType.php @@ -156,7 +156,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported */ - public function mapDataToForms($viewData, $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { $forms = iterator_to_array($forms); @@ -207,7 +207,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported */ - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { //Convert both fields to a single float value. diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php index 06347306..d42ea9d9 100644 --- a/src/Form/UserAdminForm.php +++ b/src/Form/UserAdminForm.php @@ -48,9 +48,9 @@ use Symfony\Component\Validator\Constraints\Length; class UserAdminForm extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php index 37f7b7e0..de7017d6 100644 --- a/src/Form/UserSettingsType.php +++ b/src/Form/UserSettingsType.php @@ -44,10 +44,10 @@ use Symfony\Component\Validator\Constraints\File; class UserSettingsType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected bool $demo_mode; - public function __construct(Security $security, bool $demo_mode) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, bool $demo_mode) { $this->security = $security; $this->demo_mode = $demo_mode; diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index 987787e0..95d20733 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -45,9 +45,9 @@ use function in_array; class AttachmentVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/LogEntryVoter.php b/src/Security/Voter/LogEntryVoter.php index f05de596..df1033c0 100644 --- a/src/Security/Voter/LogEntryVoter.php +++ b/src/Security/Voter/LogEntryVoter.php @@ -32,9 +32,9 @@ class LogEntryVoter extends ExtendedVoter { public const ALLOWED_OPS = ['read', 'show_details', 'delete']; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/OrderdetailVoter.php b/src/Security/Voter/OrderdetailVoter.php index eaeea11d..6b2ff874 100644 --- a/src/Security/Voter/OrderdetailVoter.php +++ b/src/Security/Voter/OrderdetailVoter.php @@ -49,9 +49,9 @@ use Symfony\Component\Security\Core\Security; class OrderdetailVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index b15afe46..6e38c718 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -41,9 +41,9 @@ use Symfony\Component\Security\Core\Security; class ParameterVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; parent::__construct($resolver, $entityManager); diff --git a/src/Security/Voter/PartLotVoter.php b/src/Security/Voter/PartLotVoter.php index 0c70e629..1d495c9a 100644 --- a/src/Security/Voter/PartLotVoter.php +++ b/src/Security/Voter/PartLotVoter.php @@ -49,9 +49,9 @@ use Symfony\Component\Security\Core\Security; class PartLotVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/PricedetailVoter.php b/src/Security/Voter/PricedetailVoter.php index eb4a81aa..8cae7452 100644 --- a/src/Security/Voter/PricedetailVoter.php +++ b/src/Security/Voter/PricedetailVoter.php @@ -49,9 +49,9 @@ use Symfony\Component\Security\Core\Security; class PricedetailVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index c4cfb09d..2d7fd3f3 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -28,7 +28,7 @@ use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; -class StructuralElementDenormalizer implements ContextAwareDenormalizerInterface, CacheableSupportsMethodInterface +class StructuralElementDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, CacheableSupportsMethodInterface { private DenormalizerInterface $normalizer; diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php index f526ac9d..bd8aa7b3 100644 --- a/src/Services/LabelSystem/LabelHTMLGenerator.php +++ b/src/Services/LabelSystem/LabelHTMLGenerator.php @@ -58,10 +58,10 @@ final class LabelHTMLGenerator private BarcodeGenerator $barcodeGenerator; private SandboxedTwigProvider $sandboxedTwigProvider; private string $partdb_title; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, LabelTextReplacer $replacer, Environment $twig, - BarcodeGenerator $barcodeGenerator, SandboxedTwigProvider $sandboxedTwigProvider, Security $security, string $partdb_title) + BarcodeGenerator $barcodeGenerator, SandboxedTwigProvider $sandboxedTwigProvider, \Symfony\Bundle\SecurityBundle\Security $security, string $partdb_title) { $this->twig = $twig; $this->elementTypeNameGenerator = $elementTypeNameGenerator; diff --git a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php index dae87fd4..5fd32a73 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php +++ b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php @@ -54,10 +54,10 @@ use Symfony\Component\Security\Core\Security; final class GlobalProviders implements PlaceholderProviderInterface { private string $partdb_title; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private UrlGeneratorInterface $url_generator; - public function __construct(string $partdb_title, Security $security, UrlGeneratorInterface $url_generator) + public function __construct(string $partdb_title, \Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $url_generator) { $this->partdb_title = $partdb_title; $this->security = $security; diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php index 0216cc3a..dde19edc 100644 --- a/src/Services/LogSystem/EventLogger.php +++ b/src/Services/LogSystem/EventLogger.php @@ -34,11 +34,11 @@ class EventLogger protected array $blacklist; protected array $whitelist; protected EntityManagerInterface $em; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected ConsoleInfoHelper $console_info_helper; public function __construct(int $minimum_log_level, array $blacklist, array $whitelist, EntityManagerInterface $em, - Security $security, ConsoleInfoHelper $console_info_helper) + \Symfony\Bundle\SecurityBundle\Security $security, ConsoleInfoHelper $console_info_helper) { $this->minimum_log_level = $minimum_log_level; $this->blacklist = $blacklist; diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index 3061d2f3..b3cccb0e 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -38,10 +38,10 @@ use Symfony\Component\Security\Core\Security; final class PartsTableActionHandler { private EntityManagerInterface $entityManager; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private UrlGeneratorInterface $urlGenerator; - public function __construct(EntityManagerInterface $entityManager, Security $security, UrlGeneratorInterface $urlGenerator) + public function __construct(EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator) { $this->entityManager = $entityManager; $this->security = $security; diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index b146d694..587dfbc7 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -53,11 +53,11 @@ class ToolsTreeBuilder protected UrlGeneratorInterface $urlGenerator; protected UserCacheKeyGenerator $keyGenerator; protected TagAwareCacheInterface $cache; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; public function __construct(TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, - Security $security) + \Symfony\Bundle\SecurityBundle\Security $security) { $this->translator = $translator; $this->urlGenerator = $urlGenerator; diff --git a/src/Services/UserSystem/UserCacheKeyGenerator.php b/src/Services/UserSystem/UserCacheKeyGenerator.php index c7c9e737..dd9e6ccb 100644 --- a/src/Services/UserSystem/UserCacheKeyGenerator.php +++ b/src/Services/UserSystem/UserCacheKeyGenerator.php @@ -32,10 +32,10 @@ use Symfony\Component\Security\Core\Security; */ class UserCacheKeyGenerator { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected RequestStack $requestStack; - public function __construct(Security $security, RequestStack $requestStack) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, RequestStack $requestStack) { $this->security = $security; $this->requestStack = $requestStack; diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php index fece2852..c2de80e2 100644 --- a/src/Validator/Constraints/NoLockoutValidator.php +++ b/src/Validator/Constraints/NoLockoutValidator.php @@ -35,10 +35,10 @@ class NoLockoutValidator extends ConstraintValidator { protected PermissionManager $resolver; protected array $perm_structure; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected EntityManagerInterface $entityManager; - public function __construct(PermissionManager $resolver, Security $security, EntityManagerInterface $entityManager) + public function __construct(PermissionManager $resolver, \Symfony\Bundle\SecurityBundle\Security $security, EntityManagerInterface $entityManager) { $this->resolver = $resolver; $this->perm_structure = $resolver->getPermissionStructure();