Applied rector rules up to symfony 6.2

This commit is contained in:
Jan Böhmer 2023-05-28 01:21:05 +02:00
parent 88ea920dfb
commit a43af180a7
145 changed files with 563 additions and 889 deletions

View file

@ -40,9 +40,10 @@ use function count;
use const DIRECTORY_SEPARATOR; 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 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 AttachmentManager $attachment_helper;
protected AttachmentReverseSearch $reverseSearch; protected AttachmentReverseSearch $reverseSearch;
@ -60,9 +61,7 @@ class CleanAttachmentsCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $this->setHelp('This command allows to find all files in the media folder which are not associated with an attachment anymore.'.
->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.'); ' These files are not needed and can eventually deleted.');
} }
@ -108,7 +107,7 @@ class CleanAttachmentsCommand extends Command
if (!$continue) { if (!$continue) {
//We are finished here, when no files should be deleted //We are finished here, when no files should be deleted
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
//Delete the files //Delete the files
@ -121,7 +120,7 @@ class CleanAttachmentsCommand extends Command
$io->success('No abandoned files found.'); $io->success('No abandoned files found.');
} }
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
/** /**

View file

@ -16,11 +16,9 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; 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 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 string $project_dir;
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;

View file

@ -27,9 +27,10 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; 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 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; protected ContainerBagInterface $params;
@ -41,9 +42,7 @@ class CheckRequirementsCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $this->addOption('only_issues', 'i', InputOption::VALUE_NONE, 'Only show issues, not success messages.')
->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.')
; ;
} }

View file

@ -35,9 +35,10 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use function count; use function count;
use function strlen; 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 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 string $base_current;
protected EntityManagerInterface $em; protected EntityManagerInterface $em;
@ -56,9 +57,7 @@ class UpdateExchangeRatesCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $this->addArgument('iso_code', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The ISO Codes of the currencies that should be updated.');
->setDescription('Updates the currency exchange rates.')
->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 protected function execute(InputInterface $input, OutputInterface $output): int
@ -69,7 +68,7 @@ class UpdateExchangeRatesCommand extends Command
if (3 !== strlen($this->base_current)) { if (3 !== strlen($this->base_current)) {
$io->error('Chosen Base current is not valid. Check your settings!'); $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); $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))); $io->success(sprintf('%d (of %d) currency exchange rates were updated.', $success_counter, count($candidates)));
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
} }

View file

@ -36,9 +36,10 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\Translation\TranslatorInterface; 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 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 EntityManagerInterface $entityManager;
protected TranslatorInterface $translator; protected TranslatorInterface $translator;
protected ElementTypeNameGenerator $elementTypeNameGenerator; protected ElementTypeNameGenerator $elementTypeNameGenerator;
@ -74,7 +75,7 @@ class ShowEventLogCommand extends Command
if ($page > $max_page && $max_page > 0) { if ($page > $max_page && $max_page > 0) {
$io->error("There is no page ${page}! The maximum page is ${max_page}."); $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."); $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); $this->showPage($output, $desc, $limit, $page, $max_page, $showExtra);
if ($onePage) { if ($onePage) {
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
$continue = $io->confirm('Do you want to show the next page?'); $continue = $io->confirm('Do you want to show the next page?');
++$page; ++$page;
} }
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
protected function configure(): void protected function configure(): void
{ {
$this $this->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'How many log entries should be shown per page.', 50)
->setDescription('List the last event log entries.')
->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('oldest_first', null, InputOption::VALUE_NONE, 'Show older entries first.')
->addOption('page', 'p', InputOption::VALUE_REQUIRED, 'Which page should be shown?', 1) ->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).') ->addOption('onePage', null, InputOption::VALUE_NONE, 'Show only one page (dont ask to go to next).')

View file

@ -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. * 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 class ConvertBBCodeCommand extends Command
{ {
/** /**
@ -58,7 +59,7 @@ class ConvertBBCodeCommand extends Command
*/ */
protected const BBCODE_REGEX = '/\\[.+\\].*\\[\\/.+\\]/'; 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 EntityManagerInterface $em;
protected PropertyAccessorInterface $propertyAccessor; protected PropertyAccessorInterface $propertyAccessor;
@ -76,9 +77,7 @@ class ConvertBBCodeCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $this->setHelp('Older versions of Part-DB (<1.0) used BBCode for rich text formatting.
->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.
Part-DB now uses Markdown which offers more features but is incompatible with BBCode. 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'); 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!'); $io->success('Changes saved to DB successfully!');
} }
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
} }

View file

@ -33,10 +33,11 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; 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 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 EntityManagerInterface $em;
protected MySQLDumpXMLConverter $xml_converter; protected MySQLDumpXMLConverter $xml_converter;
@ -60,7 +61,6 @@ class ImportPartKeeprCommand extends Command
protected function configure() 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->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.'); $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)) { if (!$this->importHelper->checkVersion($data)) {
$db_version = $this->importHelper->getDatabaseSchemaVersion($data); $db_version = $this->importHelper->getDatabaseSchemaVersion($data);
$io->error('The version of the imported database is not supported! (Version: '.$db_version.')'); $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 //Import the mandatory data
@ -118,7 +118,7 @@ class ImportPartKeeprCommand extends Command
$io->success('Imported '.$count.' users.'); $io->success('Imported '.$count.' users.');
} }
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
private function doImport(SymfonyStyle $io, array $data): void private function doImport(SymfonyStyle $io, array $data): void

View file

@ -30,9 +30,10 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; 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 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 EntityManagerInterface $entityManager;
protected bool $saml_enabled; protected bool $saml_enabled;
@ -46,9 +47,7 @@ class ConvertToSAMLUserCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $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.')
->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.')
->addArgument('user', InputArgument::REQUIRED, 'The username (or email) of the user') ->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') ->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) { if (!$user) {
$io->error('User not found!'); $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() . ']'); $io->info('User found: '.$user->getFullName(true) . ': '.$user->getEmail().' [ID: ' . $user->getID() . ']');

View file

@ -34,9 +34,10 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; 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 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 EntityManagerInterface $entityManager;
protected UserPasswordHasherInterface $encoder; protected UserPasswordHasherInterface $encoder;
@ -53,9 +54,7 @@ class SetPasswordCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $this->setHelp('This password allows you to set the password of a user, without knowing the old password.')
->setDescription('Sets the password of a user')
->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') ->addArgument('user', InputArgument::REQUIRED, 'The username or email of the user')
; ;
} }
@ -70,14 +69,14 @@ class SetPasswordCommand extends Command
if (!$user) { if (!$user) {
$io->error(sprintf('No user with the given username %s found in the database!', $user_name)); $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!'); $io->note('User found!');
if ($user->isSamlUser()) { if ($user->isSamlUser()) {
$io->error('This user is a SAML user, so you can not change the password!'); $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( $proceed = $io->confirm(
@ -85,7 +84,7 @@ class SetPasswordCommand extends Command
$user->getFullName(true), $user->getID())); $user->getFullName(true), $user->getID()));
if (!$proceed) { if (!$proceed) {
return 1; return \Symfony\Component\Console\Command\Command::FAILURE;
} }
$success = false; $success = false;
@ -116,6 +115,6 @@ class SetPasswordCommand extends Command
$security_event = new SecurityEvent($user); $security_event = new SecurityEvent($user);
$this->eventDispatcher->dispatch($security_event, SecurityEvents::PASSWORD_CHANGED); $this->eventDispatcher->dispatch($security_event, SecurityEvents::PASSWORD_CHANGED);
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
} }

View file

@ -31,11 +31,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; 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 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 PermissionSchemaUpdater $permissionSchemaUpdater;
private EntityManagerInterface $em; private EntityManagerInterface $em;
private EventCommentHelper $eventCommentHelper; private EventCommentHelper $eventCommentHelper;
@ -84,7 +82,7 @@ final class UpgradePermissionsSchemaCommand extends Command
if (empty($groups_to_upgrade) && empty($users_to_upgrade)) { if (empty($groups_to_upgrade) && empty($users_to_upgrade)) {
$io->success('All users and group permissions schemas are up-to-date. No update needed.'); $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 //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)) { if(!$io->confirm('Continue with the update?', false)) {
$io->warning('Update aborted.'); $io->warning('Update aborted.');
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
//Update all users and groups //Update all users and groups

View file

@ -29,9 +29,10 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; 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 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; protected EntityManagerInterface $entityManager;
@ -44,9 +45,7 @@ class UserEnableCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $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')
->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')
->addArgument('users', InputArgument::IS_ARRAY, 'The usernames of the users to use') ->addArgument('users', InputArgument::IS_ARRAY, 'The usernames of the users to use')
->addOption('all', 'a', InputOption::VALUE_NONE, 'Enable/Disable all users') ->addOption('all', 'a', InputOption::VALUE_NONE, 'Enable/Disable all users')
->addOption('disable', 'd', InputOption::VALUE_NONE, 'Disable the login of the given users') ->addOption('disable', 'd', InputOption::VALUE_NONE, 'Disable the login of the given users')

View file

@ -28,9 +28,10 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:list|users:list', 'Lists all users')]
class UserListCommand extends Command class UserListCommand extends Command
{ {
protected static $defaultName = 'partdb:users:list|users:list'; protected static $defaultDescription = 'Lists all users';
protected EntityManagerInterface $entityManager; protected EntityManagerInterface $entityManager;
@ -43,9 +44,7 @@ class UserListCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this $this->setHelp('This command lists all users in the database.')
->setDescription('Lists all users')
->setHelp('This command lists all users in the database.')
->addOption('local', 'l', null, 'Only list local users') ->addOption('local', 'l', null, 'Only list local users')
->addOption('saml', 's', null, 'Only list SAML users') ->addOption('saml', 's', null, 'Only list SAML users')
; ;

View file

@ -34,11 +34,9 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\Translation\TranslatorInterface; 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 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 EntityManagerInterface $entityManager;
protected UserRepository $userRepository; protected UserRepository $userRepository;
protected PermissionManager $permissionResolver; protected PermissionManager $permissionResolver;

View file

@ -27,9 +27,10 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; 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 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 VersionManagerInterface $versionManager;
protected GitVersionInfo $gitVersionInfo; protected GitVersionInfo $gitVersionInfo;
@ -43,9 +44,6 @@ class VersionCommand extends Command
protected function configure(): void protected function configure(): void
{ {
$this
->setDescription('Shows the currently installed version of Part-DB.')
;
} }
protected function execute(InputInterface $input, OutputInterface $output): int protected function execute(InputInterface $input, OutputInterface $output): int
@ -66,6 +64,6 @@ class VersionCommand extends Command
$io->info('OS: '. php_uname()); $io->info('OS: '. php_uname());
$io->info('PHP extension: '. implode(', ', get_loaded_extensions())); $io->info('PHP extension: '. implode(', ', get_loaded_extensions()));
return 0; return \Symfony\Component\Console\Command\Command::SUCCESS;
} }
} }

View file

@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/attachment_type')]
* @Route("/attachment_type")
*/
class AttachmentTypeController extends BaseAdminController class AttachmentTypeController extends BaseAdminController
{ {
protected string $entity_class = AttachmentType::class; protected string $entity_class = AttachmentType::class;
@ -48,44 +46,34 @@ class AttachmentTypeController extends BaseAdminController
protected string $attachment_class = AttachmentTypeAttachment::class; protected string $attachment_class = AttachmentTypeAttachment::class;
protected ?string $parameter_class = AttachmentTypeParameter::class; protected ?string $parameter_class = AttachmentTypeParameter::class;
/** #[Route(path: '/{id}', name: 'attachment_type_delete', methods: ['DELETE'])]
* @Route("/{id}", name="attachment_type_delete", methods={"DELETE"})
*/
public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'attachment_type_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'attachment_type_new')]
* @Route("/new", name="attachment_type_new") #[Route(path: '/{id}/clone', name: 'attachment_type_clone')]
* @Route("/{id}/clone", name="attachment_type_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'attachment_type_export_all')]
* @Route("/export", name="attachment_type_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'attachment_type_export')]
* @Route("/{id}/export", name="attachment_type_export")
*/
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -245,7 +245,7 @@ abstract class BaseAdminController extends AbstractController
/** @var AbstractPartsContainingRepository $repo */ /** @var AbstractPartsContainingRepository $repo */
$repo = $this->entityManager->getRepository($this->entity_class); $repo = $this->entityManager->getRepository($this->entity_class);
return $this->renderForm($this->twig_template, [ return $this->render($this->twig_template, [
'entity' => $entity, 'entity' => $entity,
'form' => $form, 'form' => $form,
'route_base' => $this->route_base, 'route_base' => $this->route_base,
@ -402,7 +402,7 @@ abstract class BaseAdminController extends AbstractController
} }
ret: ret:
return $this->renderForm($this->twig_template, [ return $this->render($this->twig_template, [
'entity' => $new_entity, 'entity' => $new_entity,
'form' => $form, 'form' => $form,
'import_form' => $import_form, 'import_form' => $import_form,

View file

@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/category')]
* @Route("/category")
*/
class CategoryController extends BaseAdminController class CategoryController extends BaseAdminController
{ {
protected string $entity_class = Category::class; protected string $entity_class = Category::class;
@ -47,44 +45,34 @@ class CategoryController extends BaseAdminController
protected string $attachment_class = CategoryAttachment::class; protected string $attachment_class = CategoryAttachment::class;
protected ?string $parameter_class = CategoryParameter::class; protected ?string $parameter_class = CategoryParameter::class;
/** #[Route(path: '/{id}', name: 'category_delete', methods: ['DELETE'])]
* @Route("/{id}", name="category_delete", methods={"DELETE"})
*/
public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'category_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'category_new')]
* @Route("/new", name="category_new") #[Route(path: '/{id}/clone', name: 'category_clone')]
* @Route("/{id}/clone", name="category_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'category_export_all')]
* @Route("/export", name="category_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'category_export')]
* @Route("/{id}/export", name="category_export")
*/
public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -52,10 +52,9 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
/** /**
* @Route("/currency")
*
* Class CurrencyController * Class CurrencyController
*/ */
#[Route(path: '/currency')]
class CurrencyController extends BaseAdminController class CurrencyController extends BaseAdminController
{ {
protected string $entity_class = Currency::class; protected string $entity_class = Currency::class;
@ -98,9 +97,7 @@ class CurrencyController extends BaseAdminController
); );
} }
/** #[Route(path: '/{id}', name: 'currency_delete', methods: ['DELETE'])]
* @Route("/{id}", name="currency_delete", methods={"DELETE"})
*/
public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
@ -131,36 +128,28 @@ class CurrencyController extends BaseAdminController
return true; return true;
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'currency_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'currency_new')]
* @Route("/new", name="currency_new") #[Route(path: '/{id}/clone', name: 'currency_clone')]
* @Route("/{id}/clone", name="currency_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'currency_export_all')]
* @Route("/export", name="currency_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'currency_export')]
* @Route("/{id}/export", name="currency_export")
*/
public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/footprint')]
* @Route("/footprint")
*/
class FootprintController extends BaseAdminController class FootprintController extends BaseAdminController
{ {
protected string $entity_class = Footprint::class; protected string $entity_class = Footprint::class;
@ -48,44 +46,34 @@ class FootprintController extends BaseAdminController
protected string $attachment_class = FootprintAttachment::class; protected string $attachment_class = FootprintAttachment::class;
protected ?string $parameter_class = FootprintParameter::class; protected ?string $parameter_class = FootprintParameter::class;
/** #[Route(path: '/{id}', name: 'footprint_delete', methods: ['DELETE'])]
* @Route("/{id}", name="footprint_delete", methods={"DELETE"})
*/
public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'footprint_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'footprint_new')]
* @Route("/new", name="footprint_new") #[Route(path: '/{id}/clone', name: 'footprint_clone')]
* @Route("/{id}/clone", name="footprint_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'footprint_export_all')]
* @Route("/export", name="footprint_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'footprint_export')]
* @Route("/{id}/export", name="footprint_export")
*/
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/label_profile')]
* @Route("/label_profile")
*/
class LabelProfileController extends BaseAdminController class LabelProfileController extends BaseAdminController
{ {
protected string $entity_class = LabelProfile::class; protected string $entity_class = LabelProfile::class;
@ -48,44 +46,34 @@ class LabelProfileController extends BaseAdminController
//Just a placeholder //Just a placeholder
protected ?string $parameter_class = null; protected ?string $parameter_class = null;
/** #[Route(path: '/{id}', name: 'label_profile_delete', methods: ['DELETE'])]
* @Route("/{id}", name="label_profile_delete", methods={"DELETE"})
*/
public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'label_profile_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="label_profile_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'label_profile_new')]
* @Route("/new", name="label_profile_new") #[Route(path: '/{id}/clone', name: 'label_profile_clone')]
* @Route("/{id}/clone", name="label_profile_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?LabelProfile $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?LabelProfile $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'label_profile_export_all')]
* @Route("/export", name="label_profile_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'label_profile_export')]
* @Route("/{id}/export", name="label_profile_export")
*/
public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/manufacturer')]
* @Route("/manufacturer")
*/
class ManufacturerController extends BaseAdminController class ManufacturerController extends BaseAdminController
{ {
protected string $entity_class = Manufacturer::class; protected string $entity_class = Manufacturer::class;
@ -48,45 +46,36 @@ class ManufacturerController extends BaseAdminController
protected ?string $parameter_class = ManufacturerParameter::class; protected ?string $parameter_class = ManufacturerParameter::class;
/** /**
* @Route("/{id}", name="manufacturer_delete", methods={"DELETE"})
*
* @return RedirectResponse * @return RedirectResponse
*/ */
#[Route(path: '/{id}', name: 'manufacturer_delete', methods: ['DELETE'])]
public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'manufacturer_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="manufacturer_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'manufacturer_new')]
* @Route("/new", name="manufacturer_new") #[Route(path: '/{id}/clone', name: 'manufacturer_clone')]
* @Route("/{id}/clone", name="manufacturer_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'manufacturer_export_all')]
* @Route("/export", name="manufacturer_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'manufacturer_export')]
* @Route("/{id}/export", name="manufacturer_export")
*/
public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/measurement_unit')]
* @Route("/measurement_unit")
*/
class MeasurementUnitController extends BaseAdminController class MeasurementUnitController extends BaseAdminController
{ {
protected string $entity_class = MeasurementUnit::class; protected string $entity_class = MeasurementUnit::class;
@ -48,44 +46,34 @@ class MeasurementUnitController extends BaseAdminController
protected string $attachment_class = MeasurementUnitAttachment::class; protected string $attachment_class = MeasurementUnitAttachment::class;
protected ?string $parameter_class = MeasurementUnitParameter::class; protected ?string $parameter_class = MeasurementUnitParameter::class;
/** #[Route(path: '/{id}', name: 'measurement_unit_delete', methods: ['DELETE'])]
* @Route("/{id}", name="measurement_unit_delete", methods={"DELETE"})
*/
public function delete(Request $request, MeasurementUnit $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, MeasurementUnit $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'measurement_unit_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="measurement_unit_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'measurement_unit_new')]
* @Route("/new", name="measurement_unit_new") #[Route(path: '/{id}/clone', name: 'measurement_unit_clone')]
* @Route("/{id}/clone", name="measurement_unit_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'measurement_unit_export_all')]
* @Route("/export", name="measurement_unit_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'measurement_unit_export')]
* @Route("/{id}/export", name="measurement_unit_export")
*/
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/project')]
* @Route("/project")
*/
class ProjectAdminController extends BaseAdminController class ProjectAdminController extends BaseAdminController
{ {
protected string $entity_class = Project::class; protected string $entity_class = Project::class;
@ -47,44 +45,34 @@ class ProjectAdminController extends BaseAdminController
protected string $attachment_class = ProjectAttachment::class; protected string $attachment_class = ProjectAttachment::class;
protected ?string $parameter_class = ProjectParameter::class; protected ?string $parameter_class = ProjectParameter::class;
/** #[Route(path: '/{id}', name: 'project_delete', methods: ['DELETE'])]
* @Route("/{id}", name="project_delete", methods={"DELETE"})
*/
public function delete(Request $request, Project $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Project $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'project_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="project_edit") #[Route(path: '/{id}/edit', requirements: ['id' => '\d+'])]
* @Route("/{id}/edit", requirements={"id"="\d+"})
*/
public function edit(Project $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Project $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'project_new')]
* @Route("/new", name="project_new") #[Route(path: '/{id}/clone', name: 'device_clone')]
* @Route("/{id}/clone", name="device_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Project $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Project $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'project_export_all')]
* @Route("/export", name="project_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'project_export')]
* @Route("/{id}/export", name="project_export")
*/
public function exportEntity(Project $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Project $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/store_location')]
* @Route("/store_location")
*/
class StorelocationController extends BaseAdminController class StorelocationController extends BaseAdminController
{ {
protected string $entity_class = Storelocation::class; protected string $entity_class = Storelocation::class;
@ -47,44 +45,34 @@ class StorelocationController extends BaseAdminController
protected string $attachment_class = StorelocationAttachment::class; protected string $attachment_class = StorelocationAttachment::class;
protected ?string $parameter_class = StorelocationParameter::class; protected ?string $parameter_class = StorelocationParameter::class;
/** #[Route(path: '/{id}', name: 'store_location_delete', methods: ['DELETE'])]
* @Route("/{id}", name="store_location_delete", methods={"DELETE"})
*/
public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'store_location_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="store_location_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'store_location_new')]
* @Route("/new", name="store_location_new") #[Route(path: '/{id}/clone', name: 'store_location_clone')]
* @Route("/{id}/clone", name="store_location_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'store_location_export_all')]
* @Route("/export", name="store_location_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'store_location_export')]
* @Route("/{id}/export", name="store_location_export")
*/
public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/supplier')]
* @Route("/supplier")
*/
class SupplierController extends BaseAdminController class SupplierController extends BaseAdminController
{ {
protected string $entity_class = Supplier::class; protected string $entity_class = Supplier::class;
@ -47,44 +45,34 @@ class SupplierController extends BaseAdminController
protected string $attachment_class = SupplierAttachment::class; protected string $attachment_class = SupplierAttachment::class;
protected ?string $parameter_class = SupplierParameter::class; protected ?string $parameter_class = SupplierParameter::class;
/** #[Route(path: '/{id}', name: 'supplier_delete', methods: ['DELETE'])]
* @Route("/{id}", name="supplier_delete", methods={"DELETE"})
*/
public function delete(Request $request, Supplier $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Supplier $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'supplier_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="supplier_edit") #[Route(path: '/{id}', requirements: ['id' => '\d+'])]
* @Route("/{id}", requirements={"id"="\d+"})
*/
public function edit(Supplier $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response public function edit(Supplier $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'supplier_new')]
* @Route("/new", name="supplier_new") #[Route(path: '/{id}/clone', name: 'supplier_clone')]
* @Route("/{id}/clone", name="supplier_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/export', name: 'supplier_export_all')]
* @Route("/export", name="supplier_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'supplier_export')]
* @Route("/{id}/export", name="supplier_export")
*/
public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -42,9 +42,8 @@ class AttachmentFileController extends AbstractController
{ {
/** /**
* Download the selected attachment. * 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 public function download(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
{ {
$this->denyAccessUnlessGranted('read', $attachment); $this->denyAccessUnlessGranted('read', $attachment);
@ -72,9 +71,8 @@ class AttachmentFileController extends AbstractController
/** /**
* View the attachment. * 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 public function view(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
{ {
$this->denyAccessUnlessGranted('read', $attachment); $this->denyAccessUnlessGranted('read', $attachment);
@ -100,9 +98,7 @@ class AttachmentFileController extends AbstractController
return $response; return $response;
} }
/** #[Route(path: '/attachment/list', name: 'attachment_list')]
* @Route("/attachment/list", name="attachment_list")
*/
public function attachmentsTable(Request $request, DataTableFactory $dataTableFactory, NodesListBuilder $nodesListBuilder): Response public function attachmentsTable(Request $request, DataTableFactory $dataTableFactory, NodesListBuilder $nodesListBuilder): Response
{ {
$this->denyAccessUnlessGranted('@attachments.list_attachments'); $this->denyAccessUnlessGranted('@attachments.list_attachments');
@ -124,7 +120,7 @@ class AttachmentFileController extends AbstractController
return $this->render('attachment_list.html.twig', [ return $this->render('attachment_list.html.twig', [
'datatable' => $table, 'datatable' => $table,
'filterForm' => $filterForm->createView(), 'filterForm' => $filterForm,
]); ]);
} }
} }

View file

@ -39,9 +39,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/group')]
* @Route("/group")
*/
class GroupController extends BaseAdminController class GroupController extends BaseAdminController
{ {
protected string $entity_class = Group::class; protected string $entity_class = Group::class;
@ -51,10 +49,8 @@ class GroupController extends BaseAdminController
protected string $attachment_class = GroupAttachment::class; protected string $attachment_class = GroupAttachment::class;
protected ?string $parameter_class = GroupParameter::class; protected ?string $parameter_class = GroupParameter::class;
/** #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'group_edit')]
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit") #[Route(path: '/{id}/', requirements: ['id' => '\d+'])]
* @Route("/{id}/", requirements={"id"="\d+"})
*/
public function edit(Group $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response 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) //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); return $this->_edit($entity, $request, $em, $timestamp);
} }
/** #[Route(path: '/new', name: 'group_new')]
* @Route("/new", name="group_new") #[Route(path: '/{id}/clone', name: 'group_clone')]
* @Route("/{id}/clone", name="group_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/{id}', name: 'group_delete', methods: ['DELETE'])]
* @Route("/{id}", name="group_delete", methods={"DELETE"})
*/
public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/export', name: 'group_export_all')]
* @Route("/export", name="group_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'group_export')]
* @Route("/{id}/export", name="group_export")
*/
public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);

View file

@ -61,9 +61,7 @@ class HomepageController extends AbstractController
return $banner; return $banner;
} }
/** #[Route(path: '/', name: 'homepage')]
* @Route("/", name="homepage")
*/
public function homepage(Request $request, GitVersionInfo $versionInfo, EntityManagerInterface $entityManager): Response public function homepage(Request $request, GitVersionInfo $versionInfo, EntityManagerInterface $entityManager): Response
{ {
if ($this->isGranted('@tools.lastActivity')) { if ($this->isGranted('@tools.lastActivity')) {

View file

@ -59,9 +59,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
/** #[Route(path: '/label')]
* @Route("/label")
*/
class LabelController extends AbstractController class LabelController extends AbstractController
{ {
protected LabelGenerator $labelGenerator; protected LabelGenerator $labelGenerator;
@ -80,10 +78,8 @@ class LabelController extends AbstractController
$this->translator = $translator; $this->translator = $translator;
} }
/** #[Route(path: '/dialog', name: 'label_dialog')]
* @Route("/dialog", name="label_dialog") #[Route(path: '/{profile}/dialog', name: 'label_dialog_profile')]
* @Route("/{profile}/dialog", name="label_dialog_profile")
*/
public function generator(Request $request, ?LabelProfile $profile = null): Response public function generator(Request $request, ?LabelProfile $profile = null): Response
{ {
$this->denyAccessUnlessGranted('@labels.create_labels'); $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, 'form' => $form,
'pdf_data' => $pdf_data, 'pdf_data' => $pdf_data,
'filename' => $filename, 'filename' => $filename,

View file

@ -49,9 +49,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/log')]
* @Route("/log")
*/
class LogController extends AbstractController class LogController extends AbstractController
{ {
protected EntityManagerInterface $entityManager; protected EntityManagerInterface $entityManager;
@ -66,10 +64,9 @@ class LogController extends AbstractController
} }
/** /**
* @Route("/", name="log_view")
*
* @return Response * @return Response
*/ */
#[Route(path: '/', name: 'log_view')]
public function showLogs(Request $request, DataTableFactory $dataTable): Response public function showLogs(Request $request, DataTableFactory $dataTable): Response
{ {
$this->denyAccessUnlessGranted('@system.show_logs'); $this->denyAccessUnlessGranted('@system.show_logs');
@ -93,17 +90,17 @@ class LogController extends AbstractController
return $this->render('log_system/log_list.html.twig', [ return $this->render('log_system/log_list.html.twig', [
'datatable' => $table, 'datatable' => $table,
'filterForm' => $filterForm->createView(), 'filterForm' => $filterForm,
]); ]);
} }
/** /**
* @Route("/{id}/details", name="log_details")
* @param Request $request * @param Request $request
* @param AbstractLogEntry $logEntry * @param AbstractLogEntry $logEntry
* @return Response * @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 LogLevelHelper $logLevelHelper, LogTargetHelper $logTargetHelper, EntityManagerInterface $entityManager): Response
{ {
$this->denyAccessUnlessGranted('show_details', $logEntry); $this->denyAccessUnlessGranted('show_details', $logEntry);
@ -123,9 +120,7 @@ class LogController extends AbstractController
]); ]);
} }
/** #[Route(path: '/{id}/delete', name: 'log_delete', methods: ['DELETE'])]
* @Route("/{id}/delete", name="log_delete", methods={"DELETE"})
*/
public function deleteLogEntry(Request $request, AbstractLogEntry $logEntry, EntityManagerInterface $entityManager): RedirectResponse public function deleteLogEntry(Request $request, AbstractLogEntry $logEntry, EntityManagerInterface $entityManager): RedirectResponse
{ {
$this->denyAccessUnlessGranted('delete', $logEntry); $this->denyAccessUnlessGranted('delete', $logEntry);
@ -142,9 +137,7 @@ class LogController extends AbstractController
} }
/** #[Route(path: '/undo', name: 'log_undo', methods: ['POST'])]
* @Route("/undo", name="log_undo", methods={"POST"})
*/
public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper): RedirectResponse public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper): RedirectResponse
{ {
$mode = EventUndoHelper::MODE_UNDO; $mode = EventUndoHelper::MODE_UNDO;

View file

@ -59,9 +59,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
use function Symfony\Component\Translation\t; use function Symfony\Component\Translation\t;
/** #[Route(path: '/part')]
* @Route("/part")
*/
class PartController extends AbstractController class PartController extends AbstractController
{ {
protected PricedetailHelper $pricedetailHelper; 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 * @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, public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper,
DataTableFactory $dataTable, ParameterExtractor $parameterExtractor, PartLotWithdrawAddHelper $withdrawAddHelper, ?string $timestamp = null): Response DataTableFactory $dataTable, ParameterExtractor $parameterExtractor, PartLotWithdrawAddHelper $withdrawAddHelper, ?string $timestamp = null): Response
{ {
@ -129,9 +127,7 @@ class PartController extends AbstractController
); );
} }
/** #[Route(path: '/{id}/edit', name: 'part_edit')]
* @Route("/{id}/edit", name="part_edit")
*/
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator, public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
AttachmentSubmitHandler $attachmentSubmitHandler): Response AttachmentSubmitHandler $attachmentSubmitHandler): Response
{ {
@ -182,16 +178,14 @@ class PartController extends AbstractController
$this->addFlash('error', 'part.edited_flash.invalid'); $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, 'part' => $part,
'form' => $form, 'form' => $form,
]); ]);
} }
/** #[Route(path: '/{id}/delete', name: 'part_delete', methods: ['DELETE'])]
* @Route("/{id}/delete", name="part_delete", methods={"DELETE"})
*/
public function delete(Request $request, Part $part, EntityManagerInterface $entityManager): RedirectResponse public function delete(Request $request, Part $part, EntityManagerInterface $entityManager): RedirectResponse
{ {
$this->denyAccessUnlessGranted('delete', $part); $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("part", options={"id" = "id"})
* @ParamConverter("project", options={"id" = "project_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, public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper, AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper,
?Part $part = null, ?Project $project = null): Response ?Part $part = null, ?Project $project = null): Response
@ -328,16 +322,14 @@ class PartController extends AbstractController
$this->addFlash('error', 'part.created_flash.invalid'); $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, 'part' => $new_part,
'form' => $form, 'form' => $form,
]); ]);
} }
/** #[Route(path: '/{id}/add_withdraw', name: 'part_add_withdraw', methods: ['POST'])]
* @Route("/{id}/add_withdraw", name="part_add_withdraw", methods={"POST"})
*/
public function withdrawAddHandler(Part $part, Request $request, EntityManagerInterface $em, PartLotWithdrawAddHelper $withdrawAddHelper): Response public function withdrawAddHandler(Part $part, Request $request, EntityManagerInterface $em, PartLotWithdrawAddHelper $withdrawAddHelper): Response
{ {
if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) { if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) {

View file

@ -49,10 +49,10 @@ class PartImportExportController extends AbstractController
} }
/** /**
* @Route("/parts/import", name="parts_import")
* @param Request $request * @param Request $request
* @return Response * @return Response
*/ */
#[Route(path: '/parts/import', name: 'parts_import')]
public function importParts(Request $request): Response public function importParts(Request $request): Response
{ {
$this->denyAccessUnlessGranted('@parts.import'); $this->denyAccessUnlessGranted('@parts.import');
@ -109,7 +109,7 @@ class PartImportExportController extends AbstractController
ret: ret:
return $this->renderForm('parts/import/parts_import.html.twig', [ return $this->render('parts/import/parts_import.html.twig', [
'import_form' => $import_form, 'import_form' => $import_form,
'imported_entities' => $entities ?? [], 'imported_entities' => $entities ?? [],
'import_errors' => $errors ?? [], 'import_errors' => $errors ?? [],
@ -117,9 +117,9 @@ class PartImportExportController extends AbstractController
} }
/** /**
* @Route("/parts/export", name="parts_export", methods={"GET"})
* @return Response * @return Response
*/ */
#[Route(path: '/parts/export', name: 'parts_export', methods: ['GET'])]
public function exportParts(Request $request, EntityExporter $entityExporter): Response public function exportParts(Request $request, EntityExporter $entityExporter): Response
{ {
$ids = $request->query->get('ids', ''); $ids = $request->query->get('ids', '');

View file

@ -62,9 +62,7 @@ class PartListsController extends AbstractController
$this->translator = $translator; $this->translator = $translator;
} }
/** #[Route(path: '/table/action', name: 'table_action', methods: ['POST'])]
* @Route("/table/action", name="table_action", methods={"POST"})
*/
public function tableAction(Request $request, PartsTableActionHandler $actionHandler): Response public function tableAction(Request $request, PartsTableActionHandler $actionHandler): Response
{ {
$this->denyAccessUnlessGranted('@parts.edit'); $this->denyAccessUnlessGranted('@parts.edit');
@ -175,10 +173,9 @@ class PartListsController extends AbstractController
} }
/** /**
* @Route("/category/{id}/parts", name="part_list_category")
*
* @return JsonResponse|Response * @return JsonResponse|Response
*/ */
#[Route(path: '/category/{id}/parts', name: 'part_list_category')]
public function showCategory(Category $category, Request $request): Response public function showCategory(Category $category, Request $request): Response
{ {
$this->denyAccessUnlessGranted('@categories.read'); $this->denyAccessUnlessGranted('@categories.read');
@ -197,10 +194,9 @@ class PartListsController extends AbstractController
} }
/** /**
* @Route("/footprint/{id}/parts", name="part_list_footprint")
*
* @return JsonResponse|Response * @return JsonResponse|Response
*/ */
#[Route(path: '/footprint/{id}/parts', name: 'part_list_footprint')]
public function showFootprint(Footprint $footprint, Request $request): Response public function showFootprint(Footprint $footprint, Request $request): Response
{ {
$this->denyAccessUnlessGranted('@footprints.read'); $this->denyAccessUnlessGranted('@footprints.read');
@ -219,10 +215,9 @@ class PartListsController extends AbstractController
} }
/** /**
* @Route("/manufacturer/{id}/parts", name="part_list_manufacturer")
*
* @return JsonResponse|Response * @return JsonResponse|Response
*/ */
#[Route(path: '/manufacturer/{id}/parts', name: 'part_list_manufacturer')]
public function showManufacturer(Manufacturer $manufacturer, Request $request): Response public function showManufacturer(Manufacturer $manufacturer, Request $request): Response
{ {
$this->denyAccessUnlessGranted('@manufacturers.read'); $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 * @return JsonResponse|Response
*/ */
#[Route(path: '/store_location/{id}/parts', name: 'part_list_store_location')]
public function showStorelocation(Storelocation $storelocation, Request $request): Response public function showStorelocation(Storelocation $storelocation, Request $request): Response
{ {
$this->denyAccessUnlessGranted('@storelocations.read'); $this->denyAccessUnlessGranted('@storelocations.read');
@ -263,10 +257,9 @@ class PartListsController extends AbstractController
} }
/** /**
* @Route("/supplier/{id}/parts", name="part_list_supplier")
*
* @return JsonResponse|Response * @return JsonResponse|Response
*/ */
#[Route(path: '/supplier/{id}/parts', name: 'part_list_supplier')]
public function showSupplier(Supplier $supplier, Request $request): Response public function showSupplier(Supplier $supplier, Request $request): Response
{ {
$this->denyAccessUnlessGranted('@suppliers.read'); $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 * @return JsonResponse|Response
*/ */
#[Route(path: '/parts/by_tag/{tag}', name: 'part_list_tags', requirements: ['tag' => '.*'])]
public function showTag(string $tag, Request $request): Response public function showTag(string $tag, Request $request): Response
{ {
$tag = trim($tag); $tag = trim($tag);
@ -330,10 +322,9 @@ class PartListsController extends AbstractController
} }
/** /**
* @Route("/parts/search", name="parts_search")
*
* @return JsonResponse|Response * @return JsonResponse|Response
*/ */
#[Route(path: '/parts/search', name: 'parts_search')]
public function showSearch(Request $request, DataTableFactory $dataTable): Response public function showSearch(Request $request, DataTableFactory $dataTable): Response
{ {
$searchFilter = $this->searchRequestToFilter($request); $searchFilter = $this->searchRequestToFilter($request);
@ -353,10 +344,9 @@ class PartListsController extends AbstractController
} }
/** /**
* @Route("/parts", name="parts_show_all")
*
* @return Response * @return Response
*/ */
#[Route(path: '/parts', name: 'parts_show_all')]
public function showAll(Request $request): Response public function showAll(Request $request): Response
{ {
return $this->showListWithFilter($request,'parts/lists/all_list.html.twig'); return $this->showListWithFilter($request,'parts/lists/all_list.html.twig');

View file

@ -47,9 +47,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
use function Symfony\Component\Translation\t; use function Symfony\Component\Translation\t;
/** #[Route(path: '/project')]
* @Route("/project")
*/
class ProjectController extends AbstractController class ProjectController extends AbstractController
{ {
private DataTableFactory $dataTableFactory; private DataTableFactory $dataTableFactory;
@ -59,9 +57,7 @@ class ProjectController extends AbstractController
$this->dataTableFactory = $dataTableFactory; $this->dataTableFactory = $dataTableFactory;
} }
/** #[Route(path: '/{id}/info', name: 'project_info', requirements: ['id' => '\d+'])]
* @Route("/{id}/info", name="project_info", requirements={"id"="\d+"})
*/
public function info(Project $project, Request $request, ProjectBuildHelper $buildHelper): Response public function info(Project $project, Request $request, ProjectBuildHelper $buildHelper): Response
{ {
$this->denyAccessUnlessGranted('read', $project); $this->denyAccessUnlessGranted('read', $project);
@ -80,9 +76,7 @@ class ProjectController extends AbstractController
]); ]);
} }
/** #[Route(path: '/{id}/build', name: 'project_build', requirements: ['id' => '\d+'])]
* @Route("/{id}/build", name="project_build", requirements={"id"="\d+"})
*/
public function build(Project $project, Request $request, ProjectBuildHelper $buildHelper, EntityManagerInterface $entityManager): Response public function build(Project $project, Request $request, ProjectBuildHelper $buildHelper, EntityManagerInterface $entityManager): Response
{ {
$this->denyAccessUnlessGranted('read', $project); $this->denyAccessUnlessGranted('read', $project);
@ -117,7 +111,7 @@ class ProjectController extends AbstractController
$this->addFlash('error', 'project.build.flash.invalid_input'); $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, 'buildHelper' => $buildHelper,
'project' => $project, 'project' => $project,
'build_request' => $projectBuildRequest, 'build_request' => $projectBuildRequest,
@ -126,9 +120,7 @@ class ProjectController extends AbstractController
]); ]);
} }
/** #[Route(path: '/{id}/import_bom', name: 'project_import_bom', requirements: ['id' => '\d+'])]
* @Route("/{id}/import_bom", name="project_import_bom", requirements={"id"="\d+"})
*/
public function importBOM(Request $request, EntityManagerInterface $entityManager, Project $project, public function importBOM(Request $request, EntityManagerInterface $entityManager, Project $project,
BOMImporter $BOMImporter, ValidatorInterface $validator): Response 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, 'project' => $project,
'form' => $form, 'form' => $form,
'errors' => $errors ?? null, '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 Request $request
* @param Project|null $project * @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 public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response
{ {
if($project) { if($project) {
@ -274,7 +266,7 @@ class ProjectController extends AbstractController
return $this->redirectToRoute('project_info', ['id' => $target_project->getID()]); 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, 'project' => $project,
'form' => $form, 'form' => $form,
]); ]);

View file

@ -51,9 +51,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/scan')]
* @Route("/scan")
*/
class ScanController extends AbstractController class ScanController extends AbstractController
{ {
protected BarcodeRedirector $barcodeParser; protected BarcodeRedirector $barcodeParser;
@ -65,9 +63,7 @@ class ScanController extends AbstractController
$this->barcodeNormalizer = $barcodeNormalizer; $this->barcodeNormalizer = $barcodeNormalizer;
} }
/** #[Route(path: '', name: 'scan_dialog')]
* @Route("", name="scan_dialog")
*/
public function dialog(Request $request): Response public function dialog(Request $request): Response
{ {
$this->denyAccessUnlessGranted('@tools.label_scanner'); $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, 'form' => $form,
]); ]);
} }

View file

@ -57,9 +57,7 @@ class SecurityController extends AbstractController
$this->allow_email_pw_reset = $allow_email_pw_reset; $this->allow_email_pw_reset = $allow_email_pw_reset;
} }
/** #[Route(path: '/login', name: 'login', methods: ['GET', 'POST'])]
* @Route("/login", name="login", methods={"GET", "POST"})
*/
public function login(AuthenticationUtils $authenticationUtils): Response public function login(AuthenticationUtils $authenticationUtils): Response
{ {
// get the login error if there is one // 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 * @return RedirectResponse|Response
*/ */
#[Route(path: '/pw_reset/request', name: 'pw_reset_request')]
public function requestPwReset(PasswordResetManager $passwordReset, Request $request) public function requestPwReset(PasswordResetManager $passwordReset, Request $request)
{ {
if (!$this->allow_email_pw_reset) { if (!$this->allow_email_pw_reset) {
@ -113,16 +110,15 @@ class SecurityController extends AbstractController
return $this->redirectToRoute('login'); return $this->redirectToRoute('login');
} }
return $this->renderForm('security/pw_reset_request.html.twig', [ return $this->render('security/pw_reset_request.html.twig', [
'form' => $form, 'form' => $form,
]); ]);
} }
/** /**
* @Route("/pw_reset/new_pw/{user}/{token}", name="pw_reset_new_pw")
*
* @return RedirectResponse|Response * @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) public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null)
{ {
if (!$this->allow_email_pw_reset) { 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, 'form' => $form,
]); ]);
} }
/** #[Route(path: '/logout', name: 'logout')]
* @Route("/logout", name="logout")
*/
public function logout(): void public function logout(): void
{ {
throw new RuntimeException('Will be intercepted before getting here'); throw new RuntimeException('Will be intercepted before getting here');

View file

@ -37,10 +37,9 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface; 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) * 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 class SelectAPIController extends AbstractController
{ {
private NodesListBuilder $nodesListBuilder; private NodesListBuilder $nodesListBuilder;
@ -54,49 +53,37 @@ class SelectAPIController extends AbstractController
$this->choiceHelper = $choiceHelper; $this->choiceHelper = $choiceHelper;
} }
/** #[Route(path: '/category', name: 'select_category')]
* @Route("/category", name="select_category")
*/
public function category(): Response public function category(): Response
{ {
return $this->getResponseForClass(Category::class); return $this->getResponseForClass(Category::class);
} }
/** #[Route(path: '/footprint', name: 'select_footprint')]
* @Route("/footprint", name="select_footprint")
*/
public function footprint(): Response public function footprint(): Response
{ {
return $this->getResponseForClass(Footprint::class, true); return $this->getResponseForClass(Footprint::class, true);
} }
/** #[Route(path: '/manufacturer', name: 'select_manufacturer')]
* @Route("/manufacturer", name="select_manufacturer")
*/
public function manufacturer(): Response public function manufacturer(): Response
{ {
return $this->getResponseForClass(Manufacturer::class, true); return $this->getResponseForClass(Manufacturer::class, true);
} }
/** #[Route(path: '/measurement_unit', name: 'select_measurement_unit')]
* @Route("/measurement_unit", name="select_measurement_unit")
*/
public function measurement_unit(): Response public function measurement_unit(): Response
{ {
return $this->getResponseForClass(MeasurementUnit::class, true); return $this->getResponseForClass(MeasurementUnit::class, true);
} }
/** #[Route(path: '/project', name: 'select_project')]
* @Route("/project", name="select_project")
*/
public function projects(): Response public function projects(): Response
{ {
return $this->getResponseForClass(Project::class, false); return $this->getResponseForClass(Project::class, false);
} }
/** #[Route(path: '/export_level', name: 'select_export_level')]
* @Route("/export_level", name="select_export_level")
*/
public function exportLevel(): Response public function exportLevel(): Response
{ {
$entries = [ $entries = [
@ -114,9 +101,9 @@ class SelectAPIController extends AbstractController
} }
/** /**
* @Route("/label_profiles", name="select_label_profiles")
* @return Response * @return Response
*/ */
#[Route(path: '/label_profiles', name: 'select_label_profiles')]
public function labelProfiles(EntityManagerInterface $entityManager): Response public function labelProfiles(EntityManagerInterface $entityManager): Response
{ {
$this->denyAccessUnlessGranted('@labels.create_labels'); $this->denyAccessUnlessGranted('@labels.create_labels');
@ -135,9 +122,9 @@ class SelectAPIController extends AbstractController
} }
/** /**
* @Route("/label_profiles_lot", name="select_label_profiles_lot")
* @return Response * @return Response
*/ */
#[Route(path: '/label_profiles_lot', name: 'select_label_profiles_lot')]
public function labelProfilesLot(EntityManagerInterface $entityManager): Response public function labelProfilesLot(EntityManagerInterface $entityManager): Response
{ {
$this->denyAccessUnlessGranted('@labels.create_labels'); $this->denyAccessUnlessGranted('@labels.create_labels');

View file

@ -48,9 +48,7 @@ use Symfony\Component\Routing\Annotation\Route;
class StatisticsController extends AbstractController class StatisticsController extends AbstractController
{ {
/** #[Route(path: '/statistics', name: 'statistics_view')]
* @Route("/statistics", name="statistics_view")
*/
public function showStatistics(StatisticsHelper $helper): Response public function showStatistics(StatisticsHelper $helper): Response
{ {
$this->denyAccessUnlessGranted('@tools.statistics'); $this->denyAccessUnlessGranted('@tools.statistics');

View file

@ -32,14 +32,10 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGenerator;
/** #[Route(path: '/tools')]
* @Route("/tools")
*/
class ToolsController extends AbstractController class ToolsController extends AbstractController
{ {
/** #[Route(path: '/reel_calc', name: 'tools_reel_calculator')]
* @Route("/reel_calc", name="tools_reel_calculator")
*/
public function reelCalculator(): Response public function reelCalculator(): Response
{ {
$this->denyAccessUnlessGranted('@tools.reel_calculator'); $this->denyAccessUnlessGranted('@tools.reel_calculator');
@ -47,9 +43,7 @@ class ToolsController extends AbstractController
return $this->render('tools/reel_calculator/reel_calculator.html.twig'); return $this->render('tools/reel_calculator/reel_calculator.html.twig');
} }
/** #[Route(path: '/server_infos', name: 'tools_server_infos')]
* @Route("/server_infos", name="tools_server_infos")
*/
public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper, public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper,
AttachmentSubmitHandler $attachmentSubmitHandler): Response AttachmentSubmitHandler $attachmentSubmitHandler): Response
{ {
@ -98,9 +92,9 @@ class ToolsController extends AbstractController
} }
/** /**
* @Route("/builtin_footprints", name="tools_builtin_footprints_viewer")
* @return Response * @return Response
*/ */
#[Route(path: '/builtin_footprints', name: 'tools_builtin_footprints_viewer')]
public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator): Response public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator): Response
{ {
$this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer'); $this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer');
@ -121,9 +115,9 @@ class ToolsController extends AbstractController
} }
/** /**
* @Route("/ic_logos", name="tools_ic_logos")
* @return Response * @return Response
*/ */
#[Route(path: '/ic_logos', name: 'tools_ic_logos')]
public function icLogos(): Response public function icLogos(): Response
{ {
$this->denyAccessUnlessGranted('@tools.ic_logos'); $this->denyAccessUnlessGranted('@tools.ic_logos');

View file

@ -36,9 +36,8 @@ use Symfony\Component\Routing\Annotation\Route;
/** /**
* This controller has the purpose to provide the data for all treeviews. * This controller has the purpose to provide the data for all treeviews.
*
* @Route("/tree")
*/ */
#[Route(path: '/tree')]
class TreeController extends AbstractController class TreeController extends AbstractController
{ {
protected TreeViewGenerator $treeGenerator; protected TreeViewGenerator $treeGenerator;
@ -48,9 +47,7 @@ class TreeController extends AbstractController
$this->treeGenerator = $treeGenerator; $this->treeGenerator = $treeGenerator;
} }
/** #[Route(path: '/tools', name: 'tree_tools')]
* @Route("/tools", name="tree_tools")
*/
public function tools(ToolsTreeBuilder $builder): JsonResponse public function tools(ToolsTreeBuilder $builder): JsonResponse
{ {
$tree = $builder->getTree(); $tree = $builder->getTree();
@ -58,90 +55,78 @@ class TreeController extends AbstractController
return new JsonResponse($tree); return new JsonResponse($tree);
} }
/** #[Route(path: '/category/{id}', name: 'tree_category')]
* @Route("/category/{id}", name="tree_category") #[Route(path: '/categories', name: 'tree_category_root')]
* @Route("/categories", name="tree_category_root")
*/
public function categoryTree(?Category $category = null): JsonResponse public function categoryTree(?Category $category = null): JsonResponse
{ {
if ($this->isGranted('@parts.read') && $this->isGranted('@categories.read')) { if ($this->isGranted('@parts.read') && $this->isGranted('@categories.read')) {
$tree = $this->treeGenerator->getTreeView(Category::class, $category, 'list_parts_root'); $tree = $this->treeGenerator->getTreeView(Category::class, $category, 'list_parts_root');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
} }
return new JsonResponse($tree); return new JsonResponse($tree);
} }
/** #[Route(path: '/footprint/{id}', name: 'tree_footprint')]
* @Route("/footprint/{id}", name="tree_footprint") #[Route(path: '/footprints', name: 'tree_footprint_root')]
* @Route("/footprints", name="tree_footprint_root")
*/
public function footprintTree(?Footprint $footprint = null): JsonResponse public function footprintTree(?Footprint $footprint = null): JsonResponse
{ {
if ($this->isGranted('@parts.read') && $this->isGranted('@footprints.read')) { if ($this->isGranted('@parts.read') && $this->isGranted('@footprints.read')) {
$tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint, 'list_parts_root'); $tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint, 'list_parts_root');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
} }
return new JsonResponse($tree); return new JsonResponse($tree);
} }
/** #[Route(path: '/location/{id}', name: 'tree_location')]
* @Route("/location/{id}", name="tree_location") #[Route(path: '/locations', name: 'tree_location_root')]
* @Route("/locations", name="tree_location_root")
*/
public function locationTree(?Storelocation $location = null): JsonResponse public function locationTree(?Storelocation $location = null): JsonResponse
{ {
if ($this->isGranted('@parts.read') && $this->isGranted('@storelocations.read')) { if ($this->isGranted('@parts.read') && $this->isGranted('@storelocations.read')) {
$tree = $this->treeGenerator->getTreeView(Storelocation::class, $location, 'list_parts_root'); $tree = $this->treeGenerator->getTreeView(Storelocation::class, $location, 'list_parts_root');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
} }
return new JsonResponse($tree); return new JsonResponse($tree);
} }
/** #[Route(path: '/manufacturer/{id}', name: 'tree_manufacturer')]
* @Route("/manufacturer/{id}", name="tree_manufacturer") #[Route(path: '/manufacturers', name: 'tree_manufacturer_root')]
* @Route("/manufacturers", name="tree_manufacturer_root")
*/
public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse
{ {
if ($this->isGranted('@parts.read') && $this->isGranted('@manufacturers.read')) { if ($this->isGranted('@parts.read') && $this->isGranted('@manufacturers.read')) {
$tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer, 'list_parts_root'); $tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer, 'list_parts_root');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
} }
return new JsonResponse($tree); return new JsonResponse($tree);
} }
/** #[Route(path: '/supplier/{id}', name: 'tree_supplier')]
* @Route("/supplier/{id}", name="tree_supplier") #[Route(path: '/suppliers', name: 'tree_supplier_root')]
* @Route("/suppliers", name="tree_supplier_root")
*/
public function supplierTree(?Supplier $supplier = null): JsonResponse public function supplierTree(?Supplier $supplier = null): JsonResponse
{ {
if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) { if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) {
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root'); $tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
} }
return new JsonResponse($tree); return new JsonResponse($tree);
} }
/** #[Route(path: '/device/{id}', name: 'tree_device')]
* @Route("/device/{id}", name="tree_device") #[Route(path: '/devices', name: 'tree_device_root')]
* @Route("/devices", name="tree_device_root")
*/
public function deviceTree(?Project $device = null): JsonResponse public function deviceTree(?Project $device = null): JsonResponse
{ {
if ($this->isGranted('@projects.read')) { if ($this->isGranted('@projects.read')) {
$tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices'); $tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices');
} else { } else {
return new JsonResponse("Access denied", 403); return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN);
} }
return new JsonResponse($tree); return new JsonResponse($tree);

View file

@ -51,9 +51,8 @@ use Symfony\Component\Serializer\Serializer;
/** /**
* In this controller the endpoints for the typeaheads are collected. * In this controller the endpoints for the typeaheads are collected.
*
* @Route("/typeahead")
*/ */
#[Route(path: '/typeahead')]
class TypeaheadController extends AbstractController class TypeaheadController extends AbstractController
{ {
protected AttachmentURLGenerator $urlGenerator; protected AttachmentURLGenerator $urlGenerator;
@ -65,9 +64,7 @@ class TypeaheadController extends AbstractController
$this->assets = $assets; $this->assets = $assets;
} }
/** #[Route(path: '/builtInResources/search', name: 'typeahead_builtInRessources')]
* @Route("/builtInResources/search", name="typeahead_builtInRessources")
*/
public function builtInResources(Request $request, BuiltinAttachmentsFinder $finder): JsonResponse public function builtInResources(Request $request, BuiltinAttachmentsFinder $finder): JsonResponse
{ {
$query = $request->get('query'); $query = $request->get('query');
@ -91,7 +88,7 @@ class TypeaheadController extends AbstractController
$serializer = new Serializer($normalizers, $encoders); $serializer = new Serializer($normalizers, $encoders);
$data = $serializer->serialize($result, 'json'); $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 string $query
* @param EntityManagerInterface $entityManager * @param EntityManagerInterface $entityManager
* @return JsonResponse * @return JsonResponse
*/ */
#[Route(path: '/parts/search/{query}', name: 'typeahead_parts')]
public function parts(EntityManagerInterface $entityManager, PartPreviewGenerator $previewGenerator, public function parts(EntityManagerInterface $entityManager, PartPreviewGenerator $previewGenerator,
AttachmentURLGenerator $attachmentURLGenerator, string $query = ""): JsonResponse 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 * @param string $query
* @return JsonResponse * @return JsonResponse
*/ */
#[Route(path: '/parameters/{type}/search/{query}', name: 'typeahead_parameters', requirements: ['type' => '.+'])]
public function parameters(string $type, EntityManagerInterface $entityManager, string $query = ""): JsonResponse public function parameters(string $type, EntityManagerInterface $entityManager, string $query = ""): JsonResponse
{ {
$class = $this->typeToParameterClass($type); $class = $this->typeToParameterClass($type);
@ -190,9 +187,7 @@ class TypeaheadController extends AbstractController
return new JsonResponse($data); return new JsonResponse($data);
} }
/** #[Route(path: '/tags/search/{query}', name: 'typeahead_tags', requirements: ['query' => '.+'])]
* @Route("/tags/search/{query}", name="typeahead_tags", requirements={"query"= ".+"})
*/
public function tags(string $query, TagFinder $finder): JsonResponse public function tags(string $query, TagFinder $finder): JsonResponse
{ {
$this->denyAccessUnlessGranted('@parts.read'); $this->denyAccessUnlessGranted('@parts.read');
@ -209,6 +204,6 @@ class TypeaheadController extends AbstractController
$serializer = new Serializer($normalizers, $encoders); $serializer = new Serializer($normalizers, $encoders);
$data = $serializer->serialize($array, 'json'); $data = $serializer->serialize($array, 'json');
return new JsonResponse($data, 200, [], true); return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true);
} }
} }

View file

@ -46,10 +46,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/** #[Route(path: '/user')]
* @Route("/user")
* Class UserController
*/
class UserController extends AdminPages\BaseAdminController class UserController extends AdminPages\BaseAdminController
{ {
protected string $entity_class = User::class; 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 * @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 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) //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; return true;
} }
/** #[Route(path: '/new', name: 'user_new')]
* @Route("/new", name="user_new") #[Route(path: '/{id}/clone', name: 'user_clone')]
* @Route("/{id}/clone", name="user_clone") #[Route(path: '/')]
* @Route("/")
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response
{ {
return $this->_new($request, $em, $importer, $entity); return $this->_new($request, $em, $importer, $entity);
} }
/** #[Route(path: '/{id}', name: 'user_delete', methods: ['DELETE'], requirements: ['id' => '\d+'])]
* @Route("/{id}", name="user_delete", methods={"DELETE"}, requirements={"id"="\d+"})
*/
public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{ {
if (User::ID_ANONYMOUS === $entity->getID()) { if (User::ID_ANONYMOUS === $entity->getID()) {
@ -170,26 +163,20 @@ class UserController extends AdminPages\BaseAdminController
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
/** #[Route(path: '/export', name: 'user_export_all')]
* @Route("/export", name="user_export_all")
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportAll($em, $exporter, $request); return $this->_exportAll($em, $exporter, $request);
} }
/** #[Route(path: '/{id}/export', name: 'user_export')]
* @Route("/{id}/export", name="user_export")
*/
public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response
{ {
return $this->_exportEntity($entity, $exporter, $request); return $this->_exportEntity($entity, $exporter, $request);
} }
/** #[Route(path: '/info', name: 'user_info_self')]
* @Route("/info", name="user_info_self") #[Route(path: '/{id}/info', name: 'user_info')]
* @Route("/{id}/info", name="user_info")
*/
public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response
{ {
//If no user id was passed, then we show info about the current user //If no user id was passed, then we show info about the current user
@ -229,7 +216,7 @@ class UserController extends AdminPages\BaseAdminController
'data' => $user, 'data' => $user,
]); ]);
return $this->renderForm('users/user_info.html.twig', [ return $this->render('users/user_info.html.twig', [
'user' => $user, 'user' => $user,
'form' => $builder->getForm(), 'form' => $builder->getForm(),
'datatable' => $table ?? null, 'datatable' => $table ?? null,

View file

@ -51,9 +51,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\Length;
/** #[Route(path: '/user')]
* @Route("/user")
*/
class UserSettingsController extends AbstractController class UserSettingsController extends AbstractController
{ {
protected bool $demo_mode; protected bool $demo_mode;
@ -69,9 +67,7 @@ class UserSettingsController extends AbstractController
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
} }
/** #[Route(path: '/2fa_backup_codes', name: 'show_backup_codes')]
* @Route("/2fa_backup_codes", name="show_backup_codes")
*/
public function showBackupCodes() public function showBackupCodes()
{ {
$user = $this->getUser(); $user = $this->getUser();
@ -98,9 +94,7 @@ class UserSettingsController extends AbstractController
]); ]);
} }
/** #[Route(path: '/u2f_delete', name: 'u2f_delete', methods: ['DELETE'])]
* @Route("/u2f_delete", name="u2f_delete", methods={"DELETE"})
*/
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse
{ {
if ($this->demo_mode) { if ($this->demo_mode) {
@ -181,10 +175,9 @@ class UserSettingsController extends AbstractController
} }
/** /**
* @Route("/invalidate_trustedDevices", name="tfa_trustedDevices_invalidate", methods={"DELETE"})
*
* @return RuntimeException|RedirectResponse * @return RuntimeException|RedirectResponse
*/ */
#[Route(path: '/invalidate_trustedDevices', name: 'tfa_trustedDevices_invalidate', methods: ['DELETE'])]
public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager) public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager)
{ {
if ($this->demo_mode) { if ($this->demo_mode) {
@ -219,10 +212,9 @@ class UserSettingsController extends AbstractController
} }
/** /**
* @Route("/settings", name="user_settings")
*
* @return RedirectResponse|Response * @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) public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper)
{ {
/** @var User $user */ /** @var User $user */
@ -397,7 +389,7 @@ class UserSettingsController extends AbstractController
* Output both forms * Output both forms
*****************************/ *****************************/
return $this->renderForm('users/user_settings.html.twig', [ return $this->render('users/user_settings.html.twig', [
'user' => $user, 'user' => $user,
'settings_form' => $form, 'settings_form' => $form,
'pw_form' => $pw_form, 'pw_form' => $pw_form,

View file

@ -40,9 +40,7 @@ class WebauthnKeyRegistrationController extends AbstractController
$this->demo_mode = $demo_mode; $this->demo_mode = $demo_mode;
} }
/** #[Route(path: '/webauthn/register', name: 'webauthn_register')]
* @Route("/webauthn/register", name="webauthn_register")
*/
public function register(Request $request, TFAWebauthnRegistrationHelper $registrationHelper, EntityManagerInterface $em) public function register(Request $request, TFAWebauthnRegistrationHelper $registrationHelper, EntityManagerInterface $em)
{ {
//When user change its settings, he should be logged in fully. //When user change its settings, he should be logged in fully.

View file

@ -52,9 +52,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class RevertLogColumn extends AbstractColumn class RevertLogColumn extends AbstractColumn
{ {
protected TranslatorInterface $translator; 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->translator = $translator;
$this->security = $security; $this->security = $security;

View file

@ -66,13 +66,13 @@ class LogDataTable implements DataTableTypeInterface
protected UrlGeneratorInterface $urlGenerator; protected UrlGeneratorInterface $urlGenerator;
protected EntityURLGenerator $entityURLGenerator; protected EntityURLGenerator $entityURLGenerator;
protected LogEntryRepository $logRepo; protected LogEntryRepository $logRepo;
protected Security $security; protected \Symfony\Bundle\SecurityBundle\Security $security;
protected UserAvatarHelper $userAvatarHelper; protected UserAvatarHelper $userAvatarHelper;
protected LogLevelHelper $logLevelHelper; protected LogLevelHelper $logLevelHelper;
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator, public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, 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->elementTypeNameGenerator = $elementTypeNameGenerator;
$this->translator = $translator; $this->translator = $translator;

View file

@ -56,14 +56,14 @@ final class PartsDataTable implements DataTableTypeInterface
{ {
private TranslatorInterface $translator; private TranslatorInterface $translator;
private AmountFormatter $amountFormatter; private AmountFormatter $amountFormatter;
private Security $security; private \Symfony\Bundle\SecurityBundle\Security $security;
private PartDataTableHelper $partDataTableHelper; private PartDataTableHelper $partDataTableHelper;
private EntityURLGenerator $urlGenerator; private EntityURLGenerator $urlGenerator;
public function __construct(EntityURLGenerator $urlGenerator, TranslatorInterface $translator, 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->urlGenerator = $urlGenerator;
$this->translator = $translator; $this->translator = $translator;

View file

@ -99,9 +99,9 @@ abstract class Attachment extends AbstractNamedDBElement
/** /**
* @var string the name of this element * @var string the name of this element
* @ORM\Column(type="string") * @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 = ''; protected string $name = '';
/** /**
@ -120,8 +120,8 @@ abstract class Attachment extends AbstractNamedDBElement
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type") * @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
* @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false) * @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false)
* @Selectable() * @Selectable()
* @Assert\NotNull(message="validator.attachment.must_not_be_null")
*/ */
#[Assert\NotNull(message: 'validator.attachment.must_not_be_null')]
protected ?AttachmentType $attachment_type = null; protected ?AttachmentType $attachment_type = null;
public function __construct() public function __construct()

View file

@ -44,8 +44,8 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element") * //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
* *
* Mapping is done in sub classes like part * Mapping is done in sub classes like part
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected Collection $attachments; protected Collection $attachments;
public function __construct() public function __construct()

View file

@ -63,15 +63,15 @@ class AttachmentType extends AbstractStructuralDBElement
* @var Collection<int, AttachmentTypeAttachment> * @var Collection<int, AttachmentTypeAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/** @var Collection<int, AttachmentTypeParameter> /** @var Collection<int, AttachmentTypeParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/** /**

View file

@ -29,8 +29,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* A attachment attached to an attachmentType element. * A attachment attached to an attachmentType element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class AttachmentTypeAttachment extends Attachment class AttachmentTypeAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a category element. * An attachment attached to a category element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class CategoryAttachment extends Attachment class CategoryAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Category::class; public const ALLOWED_ELEMENT_CLASS = Category::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a currency element. * An attachment attached to a currency element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class CurrencyAttachment extends Attachment class CurrencyAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Currency::class; public const ALLOWED_ELEMENT_CLASS = Currency::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a footprint element. * An attachment attached to a footprint element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class FootprintAttachment extends Attachment class FootprintAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Footprint::class; public const ALLOWED_ELEMENT_CLASS = Footprint::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a Group element. * An attachment attached to a Group element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class GroupAttachment extends Attachment class GroupAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Group::class; public const ALLOWED_ELEMENT_CLASS = Group::class;

View file

@ -49,8 +49,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* A attachment attached to a user element. * A attachment attached to a user element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class LabelAttachment extends Attachment class LabelAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = LabelProfile::class; public const ALLOWED_ELEMENT_CLASS = LabelProfile::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a manufacturer element. * An attachment attached to a manufacturer element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class ManufacturerAttachment extends Attachment class ManufacturerAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;

View file

@ -31,8 +31,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a measurement unit element. * An attachment attached to a measurement unit element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class MeasurementUnitAttachment extends Attachment class MeasurementUnitAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* A attachment attached to a part element. * A attachment attached to a part element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class PartAttachment extends Attachment class PartAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Part::class; public const ALLOWED_ELEMENT_CLASS = Part::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* A attachment attached to a device element. * A attachment attached to a device element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class ProjectAttachment extends Attachment class ProjectAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Project::class; public const ALLOWED_ELEMENT_CLASS = Project::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a measurement unit element. * An attachment attached to a measurement unit element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class StorelocationAttachment extends Attachment class StorelocationAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Storelocation::class; public const ALLOWED_ELEMENT_CLASS = Storelocation::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* A attachment attached to a supplier element. * A attachment attached to a supplier element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class SupplierAttachment extends Attachment class SupplierAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = Supplier::class; public const ALLOWED_ELEMENT_CLASS = Supplier::class;

View file

@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a user element. * An attachment attached to a user element.
* *
* @ORM\Entity() * @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/ */
#[UniqueEntity(['name', 'attachment_type', 'element'])]
class UserAttachment extends Attachment class UserAttachment extends Attachment
{ {
public const ALLOWED_ELEMENT_CLASS = User::class; public const ALLOWED_ELEMENT_CLASS = User::class;

View file

@ -37,38 +37,38 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
/** /**
* @var string The address of the company * @var string The address of the company
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected string $address = ''; protected string $address = '';
/** /**
* @var string The phone number of the company * @var string The phone number of the company
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected string $phone_number = ''; protected string $phone_number = '';
/** /**
* @var string The fax number of the company * @var string The fax number of the company
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected string $fax_number = ''; protected string $fax_number = '';
/** /**
* @var string The email address of the company * @var string The email address of the company
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\Email()
* @Groups({"full"})
*/ */
#[Assert\Email]
#[Groups(['full'])]
protected string $email_address = ''; protected string $email_address = '';
/** /**
* @var string The website of the company * @var string The website of the company
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\Url()
* @Groups({"full"})
*/ */
#[Assert\Url]
#[Groups(['full'])]
protected string $website = ''; protected string $website = '';
/** /**

View file

@ -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. * must have the table row "id"!! The ID is the unique key to identify the elements.
* *
* @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository") * @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 abstract class AbstractDBElement implements JsonSerializable
{ {
/** @var int|null The Identification number for this part. This value is unique for the element in this table. /** @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\Column(type="integer")
* @ORM\Id() * @ORM\Id()
* @ORM\GeneratedValue() * @ORM\GeneratedValue()
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected ?int $id = null; protected ?int $id = null;
public function __clone() public function __clone()

View file

@ -41,9 +41,9 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
/** /**
* @var string the name of this element * @var string the name of this element
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\NotBlank()
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Assert\NotBlank]
#[Groups(['simple', 'extended', 'full', 'import'])]
protected string $name = ''; protected string $name = '';
/****************************************************************************** /******************************************************************************

View file

@ -33,6 +33,6 @@ use Symfony\Component\Serializer\Annotation\Groups;
*/ */
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{ {
/** @Groups({"full"}) */ #[Groups(['full'])]
protected Collection $parameters; protected Collection $parameters;
} }

View file

@ -46,9 +46,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository") * @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
* *
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) * @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 abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
{ {
use ParametersTrait; use ParametersTrait;
@ -63,16 +62,16 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/** /**
* @var string The comment info for this element * @var string The comment info for this element
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected string $comment = ''; protected string $comment = '';
/** /**
* @var bool If this property is set, this element can not be selected for part properties. * @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. * Useful if this element should be used only for grouping, sorting.
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $not_selectable = false; protected bool $not_selectable = false;
/** /**
@ -85,15 +84,15 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
* subclasses. * subclasses.
* *
* @var AbstractStructuralDBElement[]|Collection * @var AbstractStructuralDBElement[]|Collection
* @Groups({"include_children"})
*/ */
#[Groups(['include_children'])]
protected Collection $children; protected Collection $children;
/** /**
* @var AbstractStructuralDBElement * @var AbstractStructuralDBElement
* @NoneOfItsChildren() * @NoneOfItsChildren()
* @Groups({"include_parents", "import"})
*/ */
#[Groups(['include_parents', 'import'])]
protected ?AbstractStructuralDBElement $parent = null; protected ?AbstractStructuralDBElement $parent = null;
/** @var string[] all names of all parent elements as an array of strings, /** @var string[] all names of all parent elements as an array of strings,

View file

@ -35,8 +35,8 @@ trait MasterAttachmentTrait
* @var Attachment|null * @var Attachment|null
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) * @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; protected ?Attachment $master_picture_attachment = null;
/** /**

View file

@ -34,15 +34,15 @@ trait TimestampTrait
/** /**
* @var DateTime|null the date when this element was modified the last time * @var DateTime|null the date when this element was modified the last time
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"}) * @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/ */
#[Groups(['extended', 'full'])]
protected ?DateTime $lastModified = null; protected ?DateTime $lastModified = null;
/** /**
* @var DateTime|null the date when this element was created * @var DateTime|null the date when this element was created
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"}) * @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/ */
#[Groups(['extended', 'full'])]
protected ?DateTime $addedDate = null; protected ?DateTime $addedDate = null;
/** /**

View file

@ -57,37 +57,37 @@ class LabelOptions
/** /**
* @var float The page size of the label in mm * @var float The page size of the label in mm
* @Assert\Positive()
* @ORM\Column(type="float") * @ORM\Column(type="float")
*/ */
#[Assert\Positive]
protected float $width = 50.0; protected float $width = 50.0;
/** /**
* @var float The page size of the label in mm * @var float The page size of the label in mm
* @Assert\Positive()
* @ORM\Column(type="float") * @ORM\Column(type="float")
*/ */
#[Assert\Positive]
protected float $height = 30.0; protected float $height = 30.0;
/** /**
* @var string The type of the barcode that should be used in the label (e.g. 'qr') * @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") * @ORM\Column(type="string")
*/ */
#[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)]
protected string $barcode_type = 'none'; protected string $barcode_type = 'none';
/** /**
* @var string What image should be shown along the * @var string What image should be shown along the
* @Assert\Choice(choices=LabelOptions::PICTURE_TYPES)
* @ORM\Column(type="string") * @ORM\Column(type="string")
*/ */
#[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)]
protected string $picture_type = 'none'; protected string $picture_type = 'none';
/** /**
* @var string * @var string
* @Assert\Choice(choices=LabelOptions::SUPPORTED_ELEMENTS)
* @ORM\Column(type="string") * @ORM\Column(type="string")
*/ */
#[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)]
protected string $supported_element = 'part'; protected string $supported_element = 'part';
/** /**
@ -97,9 +97,9 @@ class LabelOptions
protected string $additional_css = ''; protected string $additional_css = '';
/** @var string The mode that will be used to interpret the lines /** @var string The mode that will be used to interpret the lines
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
* @ORM\Column(type="string") * @ORM\Column(type="string")
*/ */
#[Assert\Choice(choices: LabelOptions::LINES_MODES)]
protected string $lines_mode = 'html'; protected string $lines_mode = 'html';
/** /**

View file

@ -52,8 +52,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository") * @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository")
* @ORM\Table(name="label_profiles") * @ORM\Table(name="label_profiles")
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
* @UniqueEntity({"name", "options.supported_element"})
*/ */
#[UniqueEntity(['name', 'options.supported_element'])]
class LabelProfile extends AttachmentContainingDBElement class LabelProfile extends AttachmentContainingDBElement
{ {
/** /**
@ -66,8 +66,8 @@ class LabelProfile extends AttachmentContainingDBElement
/** /**
* @var LabelOptions * @var LabelOptions
* @ORM\Embedded(class="LabelOptions") * @ORM\Embedded(class="LabelOptions")
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected LabelOptions $options; protected LabelOptions $options;
/** /**

View file

@ -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 * @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) * @ORM\Column(type="string", nullable=false)
* @Groups({"full"})
*/ */
#[Assert\Length(max: 20)]
#[Groups(['full'])]
protected string $symbol = ''; protected string $symbol = '';
/** /**
* @var float|null the guaranteed minimum value of this property * @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) * @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; protected ?float $value_min = null;
/** /**
* @var float|null the typical value of this property * @var float|null the typical value of this property
* @Assert\Type({"null", "float"})
* @ORM\Column(type="float", nullable=true) * @ORM\Column(type="float", nullable=true)
* @Groups({"full"})
*/ */
#[Assert\Type([null, 'float'])]
#[Groups(['full'])]
protected ?float $value_typical = null; protected ?float $value_typical = null;
/** /**
* @var float|null the maximum value of this property * @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) * @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; protected ?float $value_max = null;
/** /**
* @var string The unit in which the value values are given (e.g. V) * @var string The unit in which the value values are given (e.g. V)
* @ORM\Column(type="string", nullable=false) * @ORM\Column(type="string", nullable=false)
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected string $unit = ''; protected string $unit = '';
/** /**
* @var string a text value for the given property * @var string a text value for the given property
* @ORM\Column(type="string", nullable=false) * @ORM\Column(type="string", nullable=false)
* @Groups({"full"})
*/ */
#[Groups(['full'])]
protected string $value_text = ''; protected string $value_text = '';
/** /**
* @var string the group this parameter belongs to * @var string the group this parameter belongs to
* @ORM\Column(type="string", nullable=false, name="param_group") * @ORM\Column(type="string", nullable=false, name="param_group")
* @Groups({"full"})
* @Groups({"full"})
*/ */
#[Groups(['full'])]
#[Groups(['full'])]
protected string $group = ''; protected string $group = '';
/** /**

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class AttachmentTypeParameter extends AbstractParameter class AttachmentTypeParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class CategoryParameter extends AbstractParameter class CategoryParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Category::class; public const ALLOWED_ELEMENT_CLASS = Category::class;

View file

@ -50,8 +50,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* An attachment attached to a category element. * An attachment attached to a category element.
* *
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class CurrencyParameter extends AbstractParameter class CurrencyParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Currency::class; public const ALLOWED_ELEMENT_CLASS = Currency::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class FootprintParameter extends AbstractParameter class FootprintParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Footprint::class; public const ALLOWED_ELEMENT_CLASS = Footprint::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class GroupParameter extends AbstractParameter class GroupParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Group::class; public const ALLOWED_ELEMENT_CLASS = Group::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class ManufacturerParameter extends AbstractParameter class ManufacturerParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class MeasurementUnitParameter extends AbstractParameter class MeasurementUnitParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;

View file

@ -50,8 +50,8 @@ trait ParametersTrait
* Mapping done in subclasses. * Mapping done in subclasses.
* *
* @var Collection<int, AbstractParameter> * @var Collection<int, AbstractParameter>
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/** /**

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class PartParameter extends AbstractParameter class PartParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Part::class; public const ALLOWED_ELEMENT_CLASS = Part::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class ProjectParameter extends AbstractParameter class ProjectParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Project::class; public const ALLOWED_ELEMENT_CLASS = Project::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class StorelocationParameter extends AbstractParameter class StorelocationParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Storelocation::class; public const ALLOWED_ELEMENT_CLASS = Storelocation::class;

View file

@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @UniqueEntity(fields={"name", "group", "element"})
*/ */
#[UniqueEntity(fields: ['name', 'group', 'element'])]
class SupplierParameter extends AbstractParameter class SupplierParameter extends AbstractParameter
{ {
public const ALLOWED_ELEMENT_CLASS = Supplier::class; public const ALLOWED_ELEMENT_CLASS = Supplier::class;

View file

@ -58,74 +58,74 @@ class Category extends AbstractPartsContainingDBElement
/** /**
* @var string * @var string
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected string $partname_hint = ''; protected string $partname_hint = '';
/** /**
* @var string * @var string
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected string $partname_regex = ''; protected string $partname_regex = '';
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $disable_footprints = false; protected bool $disable_footprints = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $disable_manufacturers = false; protected bool $disable_manufacturers = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $disable_autodatasheets = false; protected bool $disable_autodatasheets = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $disable_properties = false; protected bool $disable_properties = false;
/** /**
* @var string * @var string
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected string $default_description = ''; protected string $default_description = '';
/** /**
* @var string * @var string
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected string $default_comment = ''; protected string $default_comment = '';
/** /**
* @var Collection<int, CategoryAttachment> * @var Collection<int, CategoryAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
* @Groups({"full"})
*/ */
#[Assert\Valid]
#[Groups(['full'])]
protected Collection $attachments; protected Collection $attachments;
/** @var Collection<int, CategoryParameter> /** @var Collection<int, CategoryParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
* @Groups({"full"})
*/ */
#[Assert\Valid]
#[Groups(['full'])]
protected Collection $parameters; protected Collection $parameters;
public function getPartnameHint(): string public function getPartnameHint(): string

View file

@ -57,8 +57,8 @@ class Footprint extends AbstractPartsContainingDBElement
* @var Collection<int, FootprintAttachment> * @var Collection<int, FootprintAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/** /**
@ -71,8 +71,8 @@ class Footprint extends AbstractPartsContainingDBElement
/** @var Collection<int, FootprintParameter> /** @var Collection<int, FootprintParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/**************************************** /****************************************

View file

@ -57,14 +57,14 @@ class Manufacturer extends AbstractCompany
* @var Collection<int, ManufacturerAttachment> * @var Collection<int, ManufacturerAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/** @var Collection<int, ManufacturerParameter> /** @var Collection<int, ManufacturerParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
} }

View file

@ -40,34 +40,34 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Index(name="unit_idx_name", columns={"name"}), * @ORM\Index(name="unit_idx_name", columns={"name"}),
* @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}), * @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}),
* }) * })
* @UniqueEntity("unit")
*/ */
#[UniqueEntity('unit')]
class MeasurementUnit extends AbstractPartsContainingDBElement class MeasurementUnit extends AbstractPartsContainingDBElement
{ {
/** /**
* @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams) * @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams)
* or m (for meters). * or m (for meters).
* @ORM\Column(type="string", name="unit", nullable=true) * @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; protected ?string $unit = null;
/** /**
* @var bool Determines if the amount value associated with this unit should be treated as integer. * @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. * Set to false, to measure continuous sizes likes masses or lengths.
* @ORM\Column(type="boolean", name="is_integer") * @ORM\Column(type="boolean", name="is_integer")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected bool $is_integer = false; protected bool $is_integer = false;
/** /**
* @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.). * @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 * Useful for sizes like meters. For this the unit must be set
* @ORM\Column(type="boolean", name="use_si_prefix") * @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; protected bool $use_si_prefix = false;
/** /**
@ -87,15 +87,15 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @var Collection<int, MeasurementUnitAttachment> * @var Collection<int, MeasurementUnitAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/** @var Collection<int, MeasurementUnitParameter> /** @var Collection<int, MeasurementUnitParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/** /**

View file

@ -54,8 +54,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* @ORM\Index(name="parts_idx_name", columns={"name"}), * @ORM\Index(name="parts_idx_name", columns={"name"}),
* @ORM\Index(name="parts_idx_ipn", columns={"ipn"}), * @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 class Part extends AttachmentContainingDBElement
{ {
use AdvancedPropertyTrait; use AdvancedPropertyTrait;
@ -68,11 +68,11 @@ class Part extends AttachmentContainingDBElement
use ProjectTrait; use ProjectTrait;
/** @var Collection<int, PartParameter> /** @var Collection<int, PartParameter>
* @Assert\Valid()
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Groups({"full"})
*/ */
#[Assert\Valid]
#[Groups(['full'])]
protected Collection $parameters; protected Collection $parameters;
/** /**
@ -95,9 +95,9 @@ class Part extends AttachmentContainingDBElement
* @var Collection<int, PartAttachment> * @var Collection<int, PartAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
* @Groups({"full"})
*/ */
#[Assert\Valid]
#[Groups(['full'])]
protected Collection $attachments; protected Collection $attachments;
/** /**
@ -110,8 +110,8 @@ class Part extends AttachmentContainingDBElement
* @var Attachment|null * @var Attachment|null
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) * @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; protected ?Attachment $master_picture_attachment = null;
public function __construct() public function __construct()
@ -150,9 +150,7 @@ class Part extends AttachmentContainingDBElement
parent::__clone(); parent::__clone();
} }
/** #[Assert\Callback]
* @Assert\Callback
*/
public function validate(ExecutionContextInterface $context, $payload) public function validate(ExecutionContextInterface $context, $payload)
{ {
//Ensure that the part name fullfills the regex of the category //Ensure that the part name fullfills the regex of the category

View file

@ -55,23 +55,23 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/** /**
* @var string A short description about this lot, shown in table * @var string A short description about this lot, shown in table
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Groups(['simple', 'extended', 'full', 'import'])]
protected string $description = ''; protected string $description = '';
/** /**
* @var string a comment stored with this lot * @var string a comment stored with this lot
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected string $comment = ''; protected string $comment = '';
/** /**
* @var ?DateTime Set a time until when the lot must be used. * @var ?DateTime Set a time until when the lot must be used.
* Set to null, if the lot can be used indefinitely. * Set to null, if the lot can be used indefinitely.
* @ORM\Column(type="datetime", name="expiration_date", nullable=true) * @ORM\Column(type="datetime", name="expiration_date", nullable=true)
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected ?DateTime $expiration_date = null; protected ?DateTime $expiration_date = null;
/** /**
@ -79,38 +79,38 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @ORM\ManyToOne(targetEntity="Storelocation") * @ORM\ManyToOne(targetEntity="Storelocation")
* @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true) * @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true)
* @Selectable() * @Selectable()
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Groups(['simple', 'extended', 'full', 'import'])]
protected ?Storelocation $storage_location = null; protected ?Storelocation $storage_location = null;
/** /**
* @var bool If this is set to true, the instock amount is marked as not known * @var bool If this is set to true, the instock amount is marked as not known
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Groups(['simple', 'extended', 'full', 'import'])]
protected bool $instock_unknown = false; protected bool $instock_unknown = false;
/** /**
* @var float For continuous sizes (length, volume, etc.) the instock is saved here. * @var float For continuous sizes (length, volume, etc.) the instock is saved here.
* @ORM\Column(type="float") * @ORM\Column(type="float")
* @Assert\PositiveOrZero()
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Assert\PositiveOrZero]
#[Groups(['simple', 'extended', 'full', 'import'])]
protected float $amount = 0.0; protected float $amount = 0.0;
/** /**
* @var bool determines if this lot was manually marked for refilling * @var bool determines if this lot was manually marked for refilling
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected bool $needs_refill = false; protected bool $needs_refill = false;
/** /**
* @var Part The part that is stored in this lot * @var Part The part that is stored in this lot
* @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots") * @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots")
* @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE") * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/ */
#[Assert\NotNull]
protected Part $part; protected Part $part;
/** /**
@ -338,9 +338,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
return $this->description; return $this->description;
} }
/** #[Assert\Callback]
* @Assert\Callback
*/
public function validate(ExecutionContextInterface $context, $payload) public function validate(ExecutionContextInterface $context, $payload)
{ {
//Ensure that the owner is not the anonymous user //Ensure that the owner is not the anonymous user

View file

@ -35,31 +35,31 @@ trait AdvancedPropertyTrait
/** /**
* @var bool Determines if this part entry needs review (for example, because it is work in progress) * @var bool Determines if this part entry needs review (for example, because it is work in progress)
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected bool $needs_review = false; protected bool $needs_review = false;
/** /**
* @var string a comma separated list of tags, associated with the part * @var string a comma separated list of tags, associated with the part
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected string $tags = ''; protected string $tags = '';
/** /**
* @var float|null how much a single part unit weighs in grams * @var float|null how much a single part unit weighs in grams
* @ORM\Column(type="float", nullable=true) * @ORM\Column(type="float", nullable=true)
* @Assert\PositiveOrZero()
* @Groups({"extended", "full", "import"})
*/ */
#[Assert\PositiveOrZero]
#[Groups(['extended', 'full', 'import'])]
protected ?float $mass = null; protected ?float $mass = null;
/** /**
* @var string|null The internal part number of the part * @var string|null The internal part number of the part
* @ORM\Column(type="string", length=100, nullable=true, unique=true) * @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; protected ?string $ipn = null;
/** /**

View file

@ -34,15 +34,15 @@ trait BasicPropertyTrait
/** /**
* @var string A text describing what this part does * @var string A text describing what this part does
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Groups(['simple', 'extended', 'full', 'import'])]
protected string $description = ''; protected string $description = '';
/** /**
* @var string A comment/note related to this part * @var string A comment/note related to this part
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected string $comment = ''; protected string $comment = '';
/** /**
@ -54,8 +54,8 @@ trait BasicPropertyTrait
/** /**
* @var bool true, if the part is marked as favorite * @var bool true, if the part is marked as favorite
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected bool $favorite = false; protected bool $favorite = false;
/** /**
@ -64,9 +64,9 @@ trait BasicPropertyTrait
* @ORM\ManyToOne(targetEntity="Category") * @ORM\ManyToOne(targetEntity="Category")
* @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false) * @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false)
* @Selectable() * @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; protected ?Category $category = null;
/** /**
@ -74,8 +74,8 @@ trait BasicPropertyTrait
* @ORM\ManyToOne(targetEntity="Footprint") * @ORM\ManyToOne(targetEntity="Footprint")
* @ORM\JoinColumn(name="id_footprint", referencedColumnName="id") * @ORM\JoinColumn(name="id_footprint", referencedColumnName="id")
* @Selectable() * @Selectable()
* @Groups({"simple", "extended", "full", "import"})
*/ */
#[Groups(['simple', 'extended', 'full', 'import'])]
protected ?Footprint $footprint = null; protected ?Footprint $footprint = null;
/** /**

View file

@ -37,27 +37,27 @@ trait InstockTrait
/** /**
* @var Collection|PartLot[] A list of part lots where this part is stored * @var Collection|PartLot[] A list of part lots where this part is stored
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @ORM\OrderBy({"amount" = "DESC"}) * @ORM\OrderBy({"amount" = "DESC"})
* @Groups({"extended", "full", "import"})
*/ */
#[Assert\Valid]
#[Groups(['extended', 'full', 'import'])]
protected $partLots; protected $partLots;
/** /**
* @var float The minimum amount of the part that has to be instock, otherwise more is ordered. * @var float The minimum amount of the part that has to be instock, otherwise more is ordered.
* Given in the partUnit. * Given in the partUnit.
* @ORM\Column(type="float") * @ORM\Column(type="float")
* @Assert\PositiveOrZero()
* @Groups({"extended", "full", "import"})
*/ */
#[Assert\PositiveOrZero]
#[Groups(['extended', 'full', 'import'])]
protected float $minamount = 0; protected float $minamount = 0;
/** /**
* @var ?MeasurementUnit the unit in which the part's amount is measured * @var ?MeasurementUnit the unit in which the part's amount is measured
* @ORM\ManyToOne(targetEntity="MeasurementUnit") * @ORM\ManyToOne(targetEntity="MeasurementUnit")
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true) * @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected ?MeasurementUnit $partUnit = null; protected ?MeasurementUnit $partUnit = null;
/** /**

View file

@ -39,31 +39,31 @@ trait ManufacturerTrait
* @ORM\ManyToOne(targetEntity="Manufacturer") * @ORM\ManyToOne(targetEntity="Manufacturer")
* @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id") * @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id")
* @Selectable() * @Selectable()
* @Groups({"simple","extended", "full", "import"})
*/ */
#[Groups(['simple', 'extended', 'full', 'import'])]
protected ?Manufacturer $manufacturer = null; protected ?Manufacturer $manufacturer = null;
/** /**
* @var string the url to the part on the manufacturer's homepage * @var string the url to the part on the manufacturer's homepage
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\Url()
* @Groups({"full", "import"})
*/ */
#[Assert\Url]
#[Groups(['full', 'import'])]
protected string $manufacturer_product_url = ''; protected string $manufacturer_product_url = '';
/** /**
* @var string The product number used by the manufacturer. If this is set to "", the name field is used. * @var string The product number used by the manufacturer. If this is set to "", the name field is used.
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected string $manufacturer_product_number = ''; protected string $manufacturer_product_number = '';
/** /**
* @var string|null The production status of this part. Can be one of the specified ones. * @var string|null The production status of this part. Can be one of the specified ones.
* @ORM\Column(type="string", length=255, nullable=true) * @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 = ''; protected ?string $manufacturing_status = '';
/** /**

View file

@ -37,10 +37,10 @@ trait OrderTrait
/** /**
* @var Orderdetail[]|Collection the details about how and where you can order this part * @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) * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @ORM\OrderBy({"supplierpartnr" = "ASC"}) * @ORM\OrderBy({"supplierpartnr" = "ASC"})
* @Groups({"extended", "full", "import"})
*/ */
#[Assert\Valid]
#[Groups(['extended', 'full', 'import'])]
protected $orderdetails; protected $orderdetails;
/** /**

View file

@ -66,37 +66,37 @@ class Storelocation extends AbstractPartsContainingDBElement
/** @var Collection<int, StorelocationParameter> /** @var Collection<int, StorelocationParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $is_full = false; protected bool $is_full = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $only_single_part = false; protected bool $only_single_part = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"full", "import"})
*/ */
#[Groups(['full', 'import'])]
protected bool $limit_to_existing_parts = false; protected bool $limit_to_existing_parts = false;
/** /**
* @var User|null The owner of this storage location * @var User|null The owner of this storage location
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User") * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User")
* @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL") * @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; protected ?User $owner = null;
/** /**
@ -108,8 +108,8 @@ class Storelocation extends AbstractPartsContainingDBElement
/** /**
* @var Collection<int, StorelocationAttachment> * @var Collection<int, StorelocationAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/******************************************************************************** /********************************************************************************

View file

@ -76,24 +76,24 @@ class Supplier extends AbstractCompany
/** /**
* @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier * @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) * @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5)
* @Groups({"extended", "full", "import"})
* @BigDecimalPositiveOrZero() * @BigDecimalPositiveOrZero()
*/ */
#[Groups(['extended', 'full', 'import'])]
protected ?BigDecimal $shipping_costs = null; protected ?BigDecimal $shipping_costs = null;
/** /**
* @var Collection<int, SupplierAttachment> * @var Collection<int, SupplierAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/** @var Collection<int, SupplierParameter> /** @var Collection<int, SupplierParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/** /**

View file

@ -38,13 +38,13 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* This entity describes a currency that can be used for price information. * This entity describes a currency that can be used for price information.
* *
* @UniqueEntity("iso_code")
* @ORM\Entity() * @ORM\Entity()
* @ORM\Table(name="currencies", indexes={ * @ORM\Table(name="currencies", indexes={
* @ORM\Index(name="currency_idx_name", columns={"name"}), * @ORM\Index(name="currency_idx_name", columns={"name"}),
* @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}), * @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}),
* }) * })
*/ */
#[UniqueEntity('iso_code')]
class Currency extends AbstractStructuralDBElement class Currency extends AbstractStructuralDBElement
{ {
public const PRICE_SCALE = 5; public const PRICE_SCALE = 5;
@ -60,9 +60,9 @@ class Currency extends AbstractStructuralDBElement
/** /**
* @var string the 3-letter ISO code of the currency * @var string the 3-letter ISO code of the currency
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\Currency()
* @Groups({"extended", "full", "import"})
*/ */
#[Assert\Currency]
#[Groups(['extended', 'full', 'import'])]
protected string $iso_code = ""; protected string $iso_code = "";
/** /**
@ -81,15 +81,15 @@ class Currency extends AbstractStructuralDBElement
* @var Collection<int, CurrencyAttachment> * @var Collection<int, CurrencyAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"}) * @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $attachments; protected Collection $attachments;
/** @var Collection<int, CurrencyParameter> /** @var Collection<int, CurrencyParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/ */
#[Assert\Valid]
protected Collection $parameters; protected Collection $parameters;
/** @var Collection<int, Pricedetail> /** @var Collection<int, Pricedetail>

View file

@ -45,57 +45,57 @@ use Symfony\Component\Validator\Constraints as Assert;
* }) * })
* @ORM\Entity() * @ORM\Entity()
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* @UniqueEntity({"supplierpartnr", "supplier", "part"})
*/ */
#[UniqueEntity(['supplierpartnr', 'supplier', 'part'])]
class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface
{ {
use TimestampTrait; use TimestampTrait;
/** /**
* @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @ORM\OrderBy({"min_discount_quantity" = "ASC"}) * @ORM\OrderBy({"min_discount_quantity" = "ASC"})
* @Groups({"extended", "full", "import"})
*/ */
#[Assert\Valid]
#[Groups(['extended', 'full', 'import'])]
protected Collection $pricedetails; protected Collection $pricedetails;
/** /**
* @var string * @var string
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected string $supplierpartnr = ''; protected string $supplierpartnr = '';
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"extended", "full", "import"})
*/ */
#[Groups(['extended', 'full', 'import'])]
protected bool $obsolete = false; protected bool $obsolete = false;
/** /**
* @var string * @var string
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\Url()
* @Groups({"full", "import"})
*/ */
#[Assert\Url]
#[Groups(['full', 'import'])]
protected string $supplier_product_url = ''; protected string $supplier_product_url = '';
/** /**
* @var Part|null * @var Part|null
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails") * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") * @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/ */
#[Assert\NotNull]
protected ?Part $part = null; protected ?Part $part = null;
/** /**
* @var Supplier|null * @var Supplier|null
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails") * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id") * @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; protected ?Supplier $supplier = null;
public function __construct() public function __construct()

Some files were not shown because too many files have changed in this diff Show more