mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-06 21:39:42 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -27,12 +27,12 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class ChillImportUsersCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Import users from csv file';
|
||||
/**
|
||||
* Centers and aliases.
|
||||
*
|
||||
@@ -55,7 +55,7 @@ class ChillImportUsersCommand extends Command
|
||||
public function __construct(
|
||||
protected EntityManagerInterface $em,
|
||||
protected LoggerInterface $logger,
|
||||
protected UserPasswordEncoderInterface $passwordEncoder,
|
||||
protected \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder,
|
||||
protected ValidatorInterface $validator,
|
||||
protected UserRepository $userRepository
|
||||
) {
|
||||
@@ -86,7 +86,6 @@ class ChillImportUsersCommand extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setDescription('Import users from csv file')
|
||||
->setHelp("Import users from a csv file. Users are added to centers contained in the file. Headers are used to detect columns. Adding to multiple centers can be done by using a `grouping centers` file, which will group multiple centers into a signle alias, used in 'centers' column.")
|
||||
->addArgument('csvfile', InputArgument::REQUIRED, 'Path to the csv file. Columns are: `username`, `email`, `center` (can contain alias), `permission group`')
|
||||
->addOption('grouping-centers', null, InputOption::VALUE_OPTIONAL, 'Path to a csv file to aggregate multiple centers into a single alias')
|
||||
@@ -130,7 +129,7 @@ class ChillImportUsersCommand extends Command
|
||||
->setEmail(\trim((string) $data['email']))
|
||||
->setUsername(\trim((string) $data['username']))
|
||||
->setEnabled(true)
|
||||
->setPassword($this->passwordEncoder->encodePassword(
|
||||
->setPassword($this->passwordEncoder->hashPassword(
|
||||
$user,
|
||||
\bin2hex(\random_bytes(32))
|
||||
));
|
||||
@@ -207,7 +206,7 @@ class ChillImportUsersCommand extends Command
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
*/
|
||||
class ChillUserSendRenewPasswordCodeCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Send a message with code to recover password';
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
@@ -82,7 +83,6 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
|
||||
{
|
||||
$this
|
||||
->setName('chill:user:send-password-recover-code')
|
||||
->setDescription('Send a message with code to recover password')
|
||||
->addArgument('csvfile', InputArgument::REQUIRED, 'CSV file with the list of users')
|
||||
->addOption('template', null, InputOption::VALUE_REQUIRED, 'Template for email')
|
||||
->addOption('expiration', null, InputOption::VALUE_REQUIRED, 'Expiration of the link, as an unix timestamp')
|
||||
@@ -108,7 +108,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
|
||||
$this->sendRecoverCode($user);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ExecuteCronJobCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Execute the cronjob(s) given as argument, or one cronjob scheduled by system.';
|
||||
|
||||
public function __construct(
|
||||
private readonly CronManagerInterface $cronManager
|
||||
) {
|
||||
@@ -28,7 +30,6 @@ class ExecuteCronJobCommand extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setDescription('Execute the cronjob(s) given as argument, or one cronjob scheduled by system.')
|
||||
->setHelp("If no job is specified, the next available cronjob will be executed by system.\nThis command should be execute every 15 minutes (more or less)")
|
||||
->addArgument('job', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'one or more job to force execute (by default, all jobs are executed)', [])
|
||||
->addUsage('');
|
||||
@@ -39,13 +40,13 @@ class ExecuteCronJobCommand extends Command
|
||||
if ([] === $input->getArgument('job')) {
|
||||
$this->cronManager->run();
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
foreach ($input->getArgument('job') as $jobName) {
|
||||
$this->cronManager->run($jobName);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadAddressesBEFromBestAddressCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Import BE addresses from BeST Address (see https://osoc19.github.io/best/)';
|
||||
|
||||
public function __construct(
|
||||
private readonly AddressReferenceBEFromBestAddress $addressImporter,
|
||||
private readonly PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
|
||||
@@ -32,8 +34,7 @@ class LoadAddressesBEFromBestAddressCommand extends Command
|
||||
$this
|
||||
->setName('chill:main:address-ref-from-best-addresses')
|
||||
->addArgument('lang', InputArgument::REQUIRED, "Language code, for example 'fr'")
|
||||
->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)")
|
||||
->setDescription('Import BE addresses from BeST Address (see https://osoc19.github.io/best/)');
|
||||
->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)");
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
@@ -42,6 +43,6 @@ class LoadAddressesBEFromBestAddressCommand extends Command
|
||||
|
||||
$this->addressImporter->import($input->getArgument('lang'), $input->getArgument('list'));
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadAddressesFRFromBANOCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Import FR addresses from bano (see https://bano.openstreetmap.fr';
|
||||
|
||||
public function __construct(private readonly AddressReferenceFromBano $addressReferenceFromBano)
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -27,8 +29,7 @@ class LoadAddressesFRFromBANOCommand extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('chill:main:address-ref-from-bano')
|
||||
->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers')
|
||||
->setDescription('Import FR addresses from bano (see https://bano.openstreetmap.fr');
|
||||
->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
@@ -39,6 +40,6 @@ class LoadAddressesFRFromBANOCommand extends Command
|
||||
$this->addressReferenceFromBano->import($departementNo);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -54,8 +54,6 @@ class LoadAndUpdateLanguagesCommand extends Command
|
||||
{
|
||||
$this
|
||||
->setName('chill:main:languages:populate')
|
||||
->setDescription('Load or update languages in db. This command does not delete existing '.
|
||||
'languages, but will update names according to available languages')
|
||||
->addOption(
|
||||
self::INCLUDE_REGIONAL_VERSION,
|
||||
null,
|
||||
@@ -122,6 +120,6 @@ class LoadAndUpdateLanguagesCommand extends Command
|
||||
|
||||
$em->flush();
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -55,9 +55,7 @@ class LoadCountriesCommand extends Command
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('chill:main:countries:populate')
|
||||
->setDescription('Load or update countries in db. This command does not delete existing countries, '.
|
||||
'but will update names according to available languages');
|
||||
$this->setName('chill:main:countries:populate');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,6 +81,6 @@ class LoadCountriesCommand extends Command
|
||||
|
||||
$em->flush();
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadPostalCodeFR extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Load France\'s postal code from online open data';
|
||||
|
||||
public function __construct(private readonly PostalCodeFRFromOpenData $loader)
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -25,14 +27,13 @@ class LoadPostalCodeFR extends Command
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setName('chill:main:postal-code:load:FR')
|
||||
->setDescription('Load France\'s postal code from online open data');
|
||||
$this->setName('chill:main:postal-code:load:FR');
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->loader->import();
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class LoadPostalCodesCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Add the postal code from a csv file.';
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly ValidatorInterface $validator)
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -33,7 +35,6 @@ class LoadPostalCodesCommand extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('chill:main:postal-code:populate')
|
||||
->setDescription('Add the postal code from a csv file.')
|
||||
->setHelp('This script will try to avoid existing postal code '
|
||||
."using the postal code and name. \n"
|
||||
.'The CSV file must have the following columns: '
|
||||
@@ -101,7 +102,7 @@ class LoadPostalCodesCommand extends Command
|
||||
|
||||
$output->writeln('<info>'.$num.' were added !</info>');
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
private function addPostalCode($row, OutputInterface $output)
|
||||
|
@@ -18,13 +18,14 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
|
||||
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
|
||||
|
||||
/**
|
||||
* Class SetPasswordCommand.
|
||||
*/
|
||||
class SetPasswordCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'set a password to user';
|
||||
|
||||
/**
|
||||
* SetPasswordCommand constructor.
|
||||
*/
|
||||
@@ -42,7 +43,7 @@ class SetPasswordCommand extends Command
|
||||
|
||||
public function _setPassword(User $user, $password)
|
||||
{
|
||||
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
|
||||
$defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000);
|
||||
$encoders = [
|
||||
User::class => $defaultEncoder,
|
||||
];
|
||||
@@ -56,7 +57,6 @@ class SetPasswordCommand extends Command
|
||||
public function configure()
|
||||
{
|
||||
$this->setName('chill:user:set_password')
|
||||
->setDescription('set a password to user')
|
||||
->addArgument('username', InputArgument::REQUIRED, 'the user\'s '
|
||||
.'username you want to change password')
|
||||
->addArgument('password', InputArgument::OPTIONAL, 'the new password');
|
||||
@@ -80,6 +80,6 @@ class SetPasswordCommand extends Command
|
||||
|
||||
$this->_setPassword($user, $password);
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -18,22 +18,20 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SynchronizeEntityInfoViewsCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Update or create sql views which provide info for various entities';
|
||||
|
||||
public function __construct(
|
||||
private readonly ViewEntityInfoManager $viewEntityInfoManager,
|
||||
) {
|
||||
parent::__construct('chill:db:sync-views');
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Update or create sql views which provide info for various entities');
|
||||
}
|
||||
protected function configure(): void {}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->viewEntityInfoManager->synchronizeOnDB();
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -21,13 +21,7 @@ class AbsenceController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/absence",
|
||||
* name="chill_main_user_absence_index",
|
||||
* methods={"GET", "POST"}
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/absence', name: 'chill_main_user_absence_index', methods: ['GET', 'POST'])]
|
||||
public function setAbsence(Request $request)
|
||||
{
|
||||
$user = $this->security->getUser();
|
||||
@@ -48,13 +42,7 @@ class AbsenceController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/absence/unset",
|
||||
* name="chill_main_user_absence_unset",
|
||||
* methods={"GET", "POST"}
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/absence/unset', name: 'chill_main_user_absence_unset', methods: ['GET', 'POST'])]
|
||||
public function unsetAbsence(Request $request)
|
||||
{
|
||||
$user = $this->security->getUser();
|
||||
|
@@ -24,10 +24,8 @@ class AddressApiController extends ApiController
|
||||
|
||||
/**
|
||||
* Duplicate an existing address.
|
||||
*
|
||||
* @Route("/api/1.0/main/address/{id}/duplicate.json", name="chill_api_main_address_duplicate",
|
||||
* methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/address/{id}/duplicate.json', name: 'chill_api_main_address_duplicate', methods: ['POST'])]
|
||||
public function duplicate(Address $address): JsonResponse
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
@@ -28,9 +28,7 @@ final class AddressReferenceAPIController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/address-reference/by-postal-code/{id}/search.json")
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')]
|
||||
public function search(PostalCode $postalCode, Request $request): JsonResponse
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
@@ -25,9 +25,7 @@ class AddressToReferenceMatcherController
|
||||
{
|
||||
public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) {}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/address/reference-match/{id}/set/reviewed", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/address/reference-match/{id}/set/reviewed', methods: ['POST'])]
|
||||
public function markAddressAsReviewed(Address $address): JsonResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER')) {
|
||||
@@ -48,9 +46,8 @@ class AddressToReferenceMatcherController
|
||||
|
||||
/**
|
||||
* Set an address back to "to review". Only if the address is in "reviewed" state.
|
||||
*
|
||||
* @Route("/api/1.0/main/address/reference-match/{id}/set/to_review", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/address/reference-match/{id}/set/to_review', methods: ['POST'])]
|
||||
public function markAddressAsToReview(Address $address): JsonResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER')) {
|
||||
@@ -73,9 +70,7 @@ class AddressToReferenceMatcherController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/address/reference-match/{id}/sync-with-reference", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/address/reference-match/{id}/sync-with-reference', methods: ['POST'])]
|
||||
public function syncAddressWithReference(Address $address): JsonResponse
|
||||
{
|
||||
if (null === $address->getAddressReference()) {
|
||||
|
@@ -16,41 +16,31 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AdminController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/{_locale}/admin", name="chill_main_admin_central")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin', name: 'chill_main_admin_central')]
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Admin/index.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/language", name="chill_main_language_admin")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/language', name: 'chill_main_language_admin')]
|
||||
public function indexLanguageAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Admin/indexLanguage.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/location", name="chill_main_location_admin")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/location', name: 'chill_main_location_admin')]
|
||||
public function indexLocationAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Admin/indexLocation.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/user", name="chill_main_user_admin")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/user', name: 'chill_main_user_admin')]
|
||||
public function indexUserAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Admin/indexUser.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/dashboard", name="chill_main_dashboard_admin")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/dashboard', name: 'chill_main_dashboard_admin')]
|
||||
public function indexDashboardAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Admin/indexDashboard.html.twig');
|
||||
|
@@ -24,9 +24,8 @@ final readonly class DashboardApiController
|
||||
|
||||
/**
|
||||
* Get user dashboard config (not yet based on user id and still hardcoded for now).
|
||||
*
|
||||
* @Route("/api/1.0/main/dashboard-config-item.json", methods={"get"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/dashboard-config-item.json', methods: ['get'])]
|
||||
public function getDashboardConfiguration(): JsonResponse
|
||||
{
|
||||
$data = [];
|
||||
|
@@ -18,9 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
*/
|
||||
class DefaultController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/homepage", name="chill_main_homepage")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/homepage', name: 'chill_main_homepage')]
|
||||
public function indexAction()
|
||||
{
|
||||
if ($this->isGranted('ROLE_ADMIN')) {
|
||||
@@ -30,9 +28,7 @@ class DefaultController extends AbstractController
|
||||
return $this->render('@ChillMain/layout.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/homepage", name="chill_main_homepage_without_locale")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/homepage', name: 'chill_main_homepage_without_locale')]
|
||||
public function indexWithoutLocaleAction()
|
||||
{
|
||||
return $this->redirectToRoute('chill_main_homepage');
|
||||
|
@@ -65,9 +65,7 @@ class ExportController extends AbstractController
|
||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"})
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/download/{alias}', name: 'chill_main_export_download', methods: ['GET'])]
|
||||
public function downloadResultAction(Request $request, mixed $alias)
|
||||
{
|
||||
/** @var ExportManager $exportManager */
|
||||
@@ -109,9 +107,11 @@ class ExportController extends AbstractController
|
||||
* @param string $alias
|
||||
*
|
||||
* @return Response
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])]
|
||||
public function generateAction(Request $request, $alias)
|
||||
{
|
||||
/** @var ExportManager $exportManager */
|
||||
@@ -130,10 +130,9 @@ class ExportController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/exports/generate-from-saved/{id}", name="chill_main_export_generate_from_saved")
|
||||
*
|
||||
* @throws \RedisException
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/generate-from-saved/{id}', name: 'chill_main_export_generate_from_saved')]
|
||||
public function generateFromSavedExport(SavedExport $savedExport): RedirectResponse
|
||||
{
|
||||
$this->denyAccessUnlessGranted(SavedExportVoter::GENERATE, $savedExport);
|
||||
@@ -154,9 +153,8 @@ class ExportController extends AbstractController
|
||||
|
||||
/**
|
||||
* Render the list of available exports.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/", name="chill_main_export_index")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')]
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$exportManager = $this->exportManager;
|
||||
@@ -179,9 +177,8 @@ class ExportController extends AbstractController
|
||||
* stored in the session (if valid), and then a redirection is done to next step.
|
||||
* 3. 'generate': gather data from session from the previous steps, and
|
||||
* make a redirection to the "generate" action with data in query (HTTP GET)
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/new/{alias}", name="chill_main_export_new")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/new/{alias}', name: 'chill_main_export_new')]
|
||||
public function newAction(Request $request, string $alias): Response
|
||||
{
|
||||
// first check for ACL
|
||||
@@ -205,9 +202,7 @@ class ExportController extends AbstractController
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/export/saved/update-from-key/{id}/{key}", name="chill_main_export_saved_edit_options_from_key")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/export/saved/update-from-key/{id}/{key}', name: 'chill_main_export_saved_edit_options_from_key')]
|
||||
public function editSavedExportOptionsFromKey(SavedExport $savedExport, string $key): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
@@ -227,9 +222,7 @@ class ExportController extends AbstractController
|
||||
return $this->redirectToRoute('chill_main_export_saved_edit', ['id' => $savedExport->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/export/save-from-key/{alias}/{key}", name="chill_main_export_save_from_key")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/export/save-from-key/{alias}/{key}', name: 'chill_main_export_save_from_key')]
|
||||
public function saveFromKey(string $alias, string $key, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
@@ -26,9 +26,7 @@ class GeographicalUnitByAddressApiController
|
||||
{
|
||||
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) {}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/geographical-unit/by-address/{id}.{_format}", requirements={"_format": "json"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/geographical-unit/by-address/{id}.{_format}', requirements: ['_format' => 'json'])]
|
||||
public function getGeographicalUnitCoveringAddress(Address $address): JsonResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER')) {
|
||||
|
@@ -35,9 +35,11 @@ class LoginController extends AbstractController
|
||||
* Show a login form.
|
||||
*
|
||||
* @return Response
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')]
|
||||
public function loginAction(Request $request)
|
||||
{
|
||||
return $this->render('@ChillMain/Login/login.html.twig', [
|
||||
|
@@ -29,9 +29,8 @@ class NewsItemApiController
|
||||
|
||||
/**
|
||||
* Get list of news items filtered on start and end date.
|
||||
*
|
||||
* @Route("/api/1.0/main/news/current.json", methods={"get"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/news/current.json', methods: ['get'])]
|
||||
public function listCurrentNewsItems(): JsonResponse
|
||||
{
|
||||
$total = $this->newsItemRepository->countCurrentNews();
|
||||
|
@@ -30,9 +30,7 @@ final readonly class NewsItemHistoryController
|
||||
private readonly Environment $environment,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/news-items/history", name="chill_main_news_items_history")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/news-items/history', name: 'chill_main_news_items_history')]
|
||||
public function list(): Response
|
||||
{
|
||||
$filter = $this->buildFilterOrder();
|
||||
@@ -48,9 +46,7 @@ final readonly class NewsItemHistoryController
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/news-items/{id}", name="chill_main_single_news_item")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/news-items/{id}', name: 'chill_main_single_news_item')]
|
||||
public function showSingleItem(NewsItem $newsItem, Request $request): Response
|
||||
{
|
||||
return new Response($this->environment->render(
|
||||
|
@@ -26,32 +26,24 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/notification")
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/notification')]
|
||||
class NotificationApiController
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/mark/read", name="chill_api_main_notification_mark_read", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/{id}/mark/read', name: 'chill_api_main_notification_mark_read', methods: ['POST'])]
|
||||
public function markAsRead(Notification $notification): JsonResponse
|
||||
{
|
||||
return $this->markAs('read', $notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/mark/unread", name="chill_api_main_notification_mark_unread", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/{id}/mark/unread', name: 'chill_api_main_notification_mark_unread', methods: ['POST'])]
|
||||
public function markAsUnread(Notification $notification): JsonResponse
|
||||
{
|
||||
return $this->markAs('unread', $notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/my/unread")
|
||||
*/
|
||||
#[Route(path: '/my/unread')]
|
||||
public function myUnreadNotifications(Request $request): JsonResponse
|
||||
{
|
||||
$total = $this->notificationRepository->countUnreadByUser($this->security->getUser());
|
||||
|
@@ -35,16 +35,12 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/notification")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/notification')]
|
||||
class NotificationController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* @Route("/create", name="chill_main_notification_create")
|
||||
*/
|
||||
#[Route(path: '/create', name: 'chill_main_notification_create')]
|
||||
public function createAction(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -102,9 +98,7 @@ class NotificationController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", name="chill_main_notification_edit")
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'chill_main_notification_edit')]
|
||||
public function editAction(Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_UPDATE, $notification);
|
||||
@@ -132,9 +126,7 @@ class NotificationController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/access_key", name="chill_main_notification_grant_access_by_access_key")
|
||||
*/
|
||||
#[Route(path: '/{id}/access_key', name: 'chill_main_notification_grant_access_by_access_key')]
|
||||
public function getAccessByAccessKey(Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -174,9 +166,7 @@ class NotificationController extends AbstractController
|
||||
return $this->redirectToRoute('chill_main_notification_show', ['id' => $notification->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/inbox", name="chill_main_notification_my")
|
||||
*/
|
||||
#[Route(path: '/inbox', name: 'chill_main_notification_my')]
|
||||
public function inboxAction(): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -200,9 +190,7 @@ class NotificationController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/sent", name="chill_main_notification_sent")
|
||||
*/
|
||||
#[Route(path: '/sent', name: 'chill_main_notification_sent')]
|
||||
public function sentAction(): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -226,9 +214,7 @@ class NotificationController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/show", name="chill_main_notification_show")
|
||||
*/
|
||||
#[Route(path: '/{id}/show', name: 'chill_main_notification_show')]
|
||||
public function showAction(Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_SEE, $notification);
|
||||
|
@@ -27,7 +27,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -40,21 +39,18 @@ final class PasswordController extends AbstractController
|
||||
/**
|
||||
* PasswordController constructor.
|
||||
*/
|
||||
public function __construct(private readonly LoggerInterface $chillLogger, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
public function __construct(private readonly LoggerInterface $chillLogger, private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/request-changed', name: 'password_request_recover_changed')]
|
||||
public function changeConfirmedAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Password/recover_password_changed.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/recover', name: 'password_recover')]
|
||||
public function recoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
|
||||
@@ -96,7 +92,7 @@ final class PasswordController extends AbstractController
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$password = $form->get('new_password')->getData();
|
||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
|
||||
// logging for prod
|
||||
$this
|
||||
->chillLogger
|
||||
@@ -120,9 +116,11 @@ final class PasswordController extends AbstractController
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')]
|
||||
public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
|
||||
@@ -193,9 +191,8 @@ final class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm")
|
||||
*/
|
||||
#[Route(path: '/public/{_locale}/password/request-confirm', name: 'password_request_recover_confirm')]
|
||||
public function requestRecoverConfirmAction()
|
||||
{
|
||||
return $this->render('@ChillMain/Password/request_recover_password_confirm.html.twig');
|
||||
@@ -203,9 +200,8 @@ final class PasswordController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @Route("/{_locale}/my/password", name="change_my_password")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/my/password', name: 'change_my_password')]
|
||||
public function UserPasswordAction(Request $request)
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER')) {
|
||||
@@ -234,7 +230,7 @@ final class PasswordController extends AbstractController
|
||||
]
|
||||
);
|
||||
|
||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
|
||||
|
||||
$em = $this->managerRegistry->getManager();
|
||||
$em->flush();
|
||||
|
@@ -24,10 +24,9 @@ class PermissionApiController extends AbstractController
|
||||
public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) {}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/permissions/info.json", methods={"POST"})
|
||||
*
|
||||
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/permissions/info.json', methods: ['POST'])]
|
||||
public function getPermissions(Request $request): JsonResponse
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
@@ -49,9 +49,7 @@ final class PermissionsGroupController extends AbstractController
|
||||
private readonly RoleScopeRepository $roleScopeRepository,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope", name="admin_permissionsgroup_add_role_scope", methods={"PUT"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope', name: 'admin_permissionsgroup_add_role_scope', methods: ['PUT'])]
|
||||
public function addLinkRoleScopeAction(Request $request, int $id): Response
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($id);
|
||||
@@ -129,9 +127,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* Creates a new PermissionsGroup entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/create", name="admin_permissionsgroup_create", methods={"POST"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/create', name: 'admin_permissionsgroup_create', methods: ['POST'])]
|
||||
public function createAction(Request $request): Response
|
||||
{
|
||||
$permissionsGroup = new PermissionsGroup();
|
||||
@@ -153,9 +150,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* remove an association between permissionsGroup and roleScope.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}", name="admin_permissionsgroup_delete_role_scope", methods={"DELETE"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}', name: 'admin_permissionsgroup_delete_role_scope', methods: ['DELETE'])]
|
||||
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
|
||||
@@ -211,9 +207,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing PermissionsGroup entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/edit", name="admin_permissionsgroup_edit")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/edit', name: 'admin_permissionsgroup_edit')]
|
||||
public function editAction(int $id): Response
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($id);
|
||||
@@ -259,9 +254,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* Lists all PermissionsGroup entities.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/", name="admin_permissionsgroup")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/', name: 'admin_permissionsgroup')]
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$entities = $this->permissionsGroupRepository->findAllOrderedAlphabetically();
|
||||
@@ -273,9 +267,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to create a new PermissionsGroup entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/new", name="admin_permissionsgroup_new")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/new', name: 'admin_permissionsgroup_new')]
|
||||
public function newAction(): Response
|
||||
{
|
||||
$permissionsGroup = new PermissionsGroup();
|
||||
@@ -289,9 +282,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* Finds and displays a PermissionsGroup entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/show", name="admin_permissionsgroup_show")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/show', name: 'admin_permissionsgroup_show')]
|
||||
public function showAction(int $id): Response
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($id);
|
||||
@@ -342,9 +334,8 @@ final class PermissionsGroupController extends AbstractController
|
||||
|
||||
/**
|
||||
* Edits an existing PermissionsGroup entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/update", name="admin_permissionsgroup_update", methods={"POST", "PUT"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/update', name: 'admin_permissionsgroup_update', methods: ['POST', 'PUT'])]
|
||||
public function updateAction(Request $request, int $id): Response
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository
|
||||
|
@@ -28,9 +28,7 @@ final class PostalCodeAPIController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/postal-code/search.json")
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/postal-code/search.json')]
|
||||
public function search(Request $request): JsonResponse
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
@@ -35,12 +35,9 @@ class PostalCodeController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "{_locale}/postalcode/search"
|
||||
* )
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
#[Route(path: '{_locale}/postalcode/search')]
|
||||
public function searchAction(Request $request)
|
||||
{
|
||||
$pattern = $request->query->getAlnum('q', '');
|
||||
|
@@ -36,9 +36,7 @@ class SavedExportController
|
||||
{
|
||||
public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) {}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/exports/saved/{id}/delete", name="chill_main_export_saved_delete")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/saved/{id}/delete', name: 'chill_main_export_saved_delete')]
|
||||
public function delete(SavedExport $savedExport, Request $request): Response
|
||||
{
|
||||
if (!$this->security->isGranted(SavedExportVoter::DELETE, $savedExport)) {
|
||||
@@ -71,9 +69,7 @@ class SavedExportController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/exports/saved/{id}/edit", name="chill_main_export_saved_edit")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/saved/{id}/edit', name: 'chill_main_export_saved_edit')]
|
||||
public function edit(SavedExport $savedExport, Request $request): Response
|
||||
{
|
||||
if (!$this->security->isGranted(SavedExportVoter::EDIT, $savedExport)) {
|
||||
@@ -104,9 +100,7 @@ class SavedExportController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/exports/saved/my", name="chill_main_export_saved_list_my")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/saved/my', name: 'chill_main_export_saved_list_my')]
|
||||
public function list(): Response
|
||||
{
|
||||
$user = $this->security->getUser();
|
||||
|
@@ -32,9 +32,8 @@ class ScopeController extends AbstractController
|
||||
|
||||
/**
|
||||
* Creates a new Scope entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/create", name="admin_scope_create", methods={"POST"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/create', name: 'admin_scope_create', methods: ['POST'])]
|
||||
public function createAction(Request $request)
|
||||
{
|
||||
$scope = new Scope();
|
||||
@@ -57,9 +56,8 @@ class ScopeController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing Scope entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/edit", name="admin_scope_edit")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/{id}/edit', name: 'admin_scope_edit')]
|
||||
public function editAction(Scope $scope, Request $request): Response
|
||||
{
|
||||
$editForm = $this->createEditForm($scope);
|
||||
@@ -79,9 +77,8 @@ class ScopeController extends AbstractController
|
||||
|
||||
/**
|
||||
* Lists all Scope entities.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/", name="admin_scope")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/', name: 'admin_scope')]
|
||||
public function indexAction()
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
@@ -95,9 +92,8 @@ class ScopeController extends AbstractController
|
||||
|
||||
/**
|
||||
* Displays a form to create a new Scope entity.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/new", name="admin_scope_new")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/new', name: 'admin_scope_new')]
|
||||
public function newAction()
|
||||
{
|
||||
$scope = new Scope();
|
||||
|
@@ -34,9 +34,7 @@ class SearchController extends AbstractController
|
||||
{
|
||||
public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) {}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced/{name}', name: 'chill_main_advanced_search')]
|
||||
public function advancedSearchAction(mixed $name, Request $request)
|
||||
{
|
||||
try {
|
||||
@@ -81,9 +79,7 @@ class SearchController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced", name="chill_main_advanced_search_list")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced', name: 'chill_main_advanced_search_list')]
|
||||
public function advancedSearchListAction(Request $request)
|
||||
{
|
||||
/** @var Chill\MainBundle\Search\SearchProvider $variable */
|
||||
@@ -100,9 +96,7 @@ class SearchController extends AbstractController
|
||||
return $this->render('@ChillMain/Search/choose_list.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search.{_format}", name="chill_main_search", requirements={"_format"="html|json"}, defaults={"_format"="html"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search.{_format}', name: 'chill_main_search', requirements: ['_format' => 'html|json'], defaults: ['_format' => 'html'])]
|
||||
public function searchAction(Request $request, mixed $_format)
|
||||
{
|
||||
$pattern = trim((string) $request->query->get('q', ''));
|
||||
@@ -192,9 +186,7 @@ class SearchController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/api/1.0/search.{_format}", name="chill_main_search_global", requirements={"_format"="json"}, defaults={"_format"="json"})
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/api/1.0/search.{_format}', name: 'chill_main_search_global', requirements: ['_format' => 'json'], defaults: ['_format' => 'json'])]
|
||||
public function searchApi(Request $request, mixed $_format): JsonResponse
|
||||
{
|
||||
// TODO this is an incomplete implementation
|
||||
|
@@ -22,12 +22,7 @@ class TimelineCenterController extends AbstractController
|
||||
{
|
||||
public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) {}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/center/timeline",
|
||||
* name="chill_center_timeline",
|
||||
* methods={"GET"}
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/center/timeline', name: 'chill_center_timeline', methods: ['GET'])]
|
||||
public function centerAction(Request $request)
|
||||
{
|
||||
// collect reachable center for each group
|
||||
|
@@ -24,15 +24,7 @@ class UserApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly ChillSecurity $security) {}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/api/1.0/main/user-current-location.{_format}",
|
||||
* name="chill_main_user_current_location",
|
||||
* requirements={
|
||||
* "_format": "json"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/user-current-location.{_format}', name: 'chill_main_user_current_location', requirements: ['_format' => 'json'])]
|
||||
public function currentLocation(mixed $_format): JsonResponse
|
||||
{
|
||||
if (!$this->isGranted('ROLE_USER')) {
|
||||
@@ -47,15 +39,7 @@ class UserApiController extends ApiController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/api/1.0/main/whoami.{_format}",
|
||||
* name="chill_main_user_whoami",
|
||||
* requirements={
|
||||
* "_format": "json"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/whoami.{_format}', name: 'chill_main_user_whoami', requirements: ['_format' => 'json'])]
|
||||
public function whoami(mixed $_format): JsonResponse
|
||||
{
|
||||
return $this->json(
|
||||
|
@@ -31,7 +31,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
@@ -42,7 +41,7 @@ class UserController extends CRUDController
|
||||
public function __construct(
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly ValidatorInterface $validator,
|
||||
private readonly UserPasswordEncoderInterface $passwordEncoder,
|
||||
private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder,
|
||||
private readonly UserRepository $userRepository,
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
private readonly TranslatorInterface $translator,
|
||||
@@ -50,10 +49,7 @@ class UserController extends CRUDController
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter",
|
||||
* name="admin_user_add_groupcenter")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/main/user/{uid}/add_link_groupcenter', name: 'admin_user_add_groupcenter')]
|
||||
public function addLinkGroupCenterAction(Request $request, mixed $uid): Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
@@ -102,10 +98,7 @@ class UserController extends CRUDController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}",
|
||||
* name="admin_user_delete_groupcenter")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}', name: 'admin_user_delete_groupcenter')]
|
||||
public function deleteLinkGroupCenterAction(mixed $uid, mixed $gcid, Request $request): RedirectResponse
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
@@ -202,9 +195,8 @@ class UserController extends CRUDController
|
||||
|
||||
/**
|
||||
* Displays a form to edit the user current location.
|
||||
*
|
||||
* @Route("/{_locale}/main/user/current-location/edit", name="chill_main_user_currentlocation_edit")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/user/current-location/edit', name: 'chill_main_user_currentlocation_edit')]
|
||||
public function editCurrentLocationAction(Request $request)
|
||||
{
|
||||
$user = $this->security->getUser();
|
||||
@@ -234,9 +226,8 @@ class UserController extends CRUDController
|
||||
|
||||
/**
|
||||
* Displays a form to edit the user password.
|
||||
*
|
||||
* @Route("/{_locale}/admin/user/{id}/edit_password", name="admin_user_edit_password")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/user/{id}/edit_password', name: 'admin_user_edit_password')]
|
||||
public function editPasswordAction(User $user, Request $request)
|
||||
{
|
||||
$editForm = $this->createEditPasswordForm($user);
|
||||
@@ -251,7 +242,7 @@ class UserController extends CRUDController
|
||||
'user' => $user->getUsername(),
|
||||
]);
|
||||
|
||||
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
|
||||
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
|
||||
|
||||
$this->managerRegistry->getManager()->flush();
|
||||
$this->addFlash('success', $this->translator->trans('Password successfully updated!'));
|
||||
@@ -360,7 +351,7 @@ class UserController extends CRUDController
|
||||
// for "new", encode the password
|
||||
if ('new' === $action && $this->parameterBag->get('chill_main.access_user_change_password')) {
|
||||
$entity->setPassword($this->passwordEncoder
|
||||
->encodePassword($entity, $form['plainPassword']->getData()));
|
||||
->hashPassword($entity, $form['plainPassword']->getData()));
|
||||
}
|
||||
|
||||
// default behaviour
|
||||
|
@@ -33,9 +33,8 @@ final readonly class UserExportController
|
||||
* @throws \League\Csv\CannotInsertRecord
|
||||
* @throws \League\Csv\Exception
|
||||
* @throws \League\Csv\UnavailableStream
|
||||
*
|
||||
* @Route("/{_locale}/admin/main/users/export/list.{_format}", requirements={"_format": "csv"}, name="chill_main_users_export_list")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/main/users/export/list.{_format}', requirements: ['_format' => 'csv'], name: 'chill_main_users_export_list')]
|
||||
public function userList(Request $request, string $_format = 'csv'): StreamedResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_ADMIN')) {
|
||||
@@ -94,9 +93,8 @@ final readonly class UserExportController
|
||||
* @throws \League\Csv\CannotInsertRecord
|
||||
* @throws \League\Csv\Exception
|
||||
* @throws \League\Csv\UnavailableStream
|
||||
*
|
||||
* @Route("/{_locale}/admin/main/users/export/permissions.{_format}", requirements={"_format": "csv"}, name="chill_main_users_export_permissions")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/main/users/export/permissions.{_format}', requirements: ['_format' => 'csv'], name: 'chill_main_users_export_permissions')]
|
||||
public function userPermissionsList(string $_format = 'csv'): StreamedResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_ADMIN')) {
|
||||
|
@@ -23,9 +23,7 @@ class UserJobScopeHistoriesController extends AbstractController
|
||||
private readonly Environment $engine,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/main/user/{id}/job-scope-history", name="admin_user_job_scope_history")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/main/user/{id}/job-scope-history', name: 'admin_user_job_scope_history')]
|
||||
public function indexAction(User $user): Response
|
||||
{
|
||||
$jobHistories = $user->getUserJobHistoriesOrdered();
|
||||
|
@@ -32,9 +32,8 @@ final class UserProfileController extends AbstractController
|
||||
|
||||
/**
|
||||
* User profile that allows editing of phonenumber and visualization of certain data.
|
||||
*
|
||||
* @Route("/{_locale}/main/user/my-profile", name="chill_main_user_profile")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/user/my-profile', name: 'chill_main_user_profile')]
|
||||
public function __invoke(Request $request)
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER')) {
|
||||
|
@@ -33,9 +33,8 @@ class WorkflowApiController
|
||||
|
||||
/**
|
||||
* Return a list of workflow which are waiting an action for the user.
|
||||
*
|
||||
* @Route("/api/1.0/main/workflow/my", methods={"GET"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/workflow/my', methods: ['GET'])]
|
||||
public function myWorkflow(Request $request): JsonResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) {
|
||||
@@ -72,9 +71,8 @@ class WorkflowApiController
|
||||
|
||||
/**
|
||||
* Return a list of workflow which are waiting an action for the user.
|
||||
*
|
||||
* @Route("/api/1.0/main/workflow/my-cc", methods={"GET"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/workflow/my-cc', methods: ['GET'])]
|
||||
public function myWorkflowCc(Request $request): JsonResponse
|
||||
{
|
||||
if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) {
|
||||
@@ -109,17 +107,13 @@ class WorkflowApiController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/workflow/{id}/subscribe", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/workflow/{id}/subscribe', methods: ['POST'])]
|
||||
public function subscribe(EntityWorkflow $entityWorkflow, Request $request): Response
|
||||
{
|
||||
return $this->handleSubscription($entityWorkflow, $request, 'subscribe');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/main/workflow/{id}/unsubscribe", methods={"POST"})
|
||||
*/
|
||||
#[Route(path: '/api/1.0/main/workflow/{id}/unsubscribe', methods: ['POST'])]
|
||||
public function unsubscribe(EntityWorkflow $entityWorkflow, Request $request): Response
|
||||
{
|
||||
return $this->handleSubscription($entityWorkflow, $request, 'unsubscribe');
|
||||
|
@@ -40,9 +40,7 @@ class WorkflowController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/create', name: 'chill_main_workflow_create')]
|
||||
public function create(Request $request): Response
|
||||
{
|
||||
if (!$request->query->has('entityClass')) {
|
||||
@@ -86,9 +84,7 @@ class WorkflowController extends AbstractController
|
||||
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow/{id}/delete", name="chill_main_workflow_delete")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/{id}/delete', name: 'chill_main_workflow_delete')]
|
||||
public function delete(EntityWorkflow $entityWorkflow, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(EntityWorkflowVoter::DELETE, $entityWorkflow);
|
||||
@@ -113,9 +109,7 @@ class WorkflowController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow-step/{id}/access_key", name="chill_main_workflow_grant_access_by_key")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow-step/{id}/access_key', name: 'chill_main_workflow_grant_access_by_key')]
|
||||
public function getAccessByAccessKey(EntityWorkflowStep $entityWorkflowStep, Request $request): Response
|
||||
{
|
||||
if (null === $accessKey = $request->query->get('accessKey', null)) {
|
||||
@@ -143,9 +137,8 @@ class WorkflowController extends AbstractController
|
||||
|
||||
/**
|
||||
* Previous workflows where the user has applyed a transition.
|
||||
*
|
||||
* @Route("/{_locale}/main/workflow/list/previous_transitionned", name="chill_main_workflow_list_previous_transitionned")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/list/previous_transitionned', name: 'chill_main_workflow_list_previous_transitionned')]
|
||||
public function myPreviousWorkflowsTransitionned(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -173,9 +166,8 @@ class WorkflowController extends AbstractController
|
||||
|
||||
/**
|
||||
* Previous workflows where the user was mentioned, but did not give any reaction.
|
||||
*
|
||||
* @Route("/{_locale}/main/workflow/list/previous_without_reaction", name="chill_main_workflow_list_previous_without_reaction")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/list/previous_without_reaction', name: 'chill_main_workflow_list_previous_without_reaction')]
|
||||
public function myPreviousWorkflowsWithoutReaction(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -201,9 +193,7 @@ class WorkflowController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow/list/cc", name="chill_main_workflow_list_cc")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/list/cc', name: 'chill_main_workflow_list_cc')]
|
||||
public function myWorkflowsCc(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -228,9 +218,7 @@ class WorkflowController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/list/dest', name: 'chill_main_workflow_list_dest')]
|
||||
public function myWorkflowsDest(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -255,9 +243,7 @@ class WorkflowController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow/list/subscribed", name="chill_main_workflow_list_subscribed")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/list/subscribed', name: 'chill_main_workflow_list_subscribed')]
|
||||
public function myWorkflowsSubscribed(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
@@ -282,9 +268,7 @@ class WorkflowController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/main/workflow/{id}/show", name="chill_main_workflow_show")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/main/workflow/{id}/show', name: 'chill_main_workflow_show')]
|
||||
public function show(EntityWorkflow $entityWorkflow, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(EntityWorkflowVoter::SEE, $entityWorkflow);
|
||||
|
@@ -18,7 +18,6 @@ use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
|
||||
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
|
||||
|
||||
/**
|
||||
* Load fixtures users into database.
|
||||
@@ -65,7 +64,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
|
||||
foreach (self::$refs as $username => $params) {
|
||||
$user = new User();
|
||||
|
||||
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
|
||||
$defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000);
|
||||
|
||||
$encoderFactory = new EncoderFactory([
|
||||
User::class => $defaultEncoder,
|
||||
|
@@ -20,18 +20,16 @@ trait TrackCreationTrait
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?User $createdBy = null;
|
||||
|
||||
public function getCreatedAt(): ?\DateTimeInterface
|
||||
|
@@ -20,18 +20,16 @@ trait TrackUpdateTrait
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
public function getUpdatedAt(): ?\DateTimeInterface
|
||||
|
@@ -57,60 +57,52 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AddressReference::class)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private ?AddressReference $addressReference = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $buildingName = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private bool $confidential = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $corridor = '';
|
||||
|
||||
/**
|
||||
* used for the CEDEX information.
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $distribution = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $extra = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $flat = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $floor = '';
|
||||
|
||||
/**
|
||||
@@ -140,19 +132,17 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*
|
||||
* @readonly
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* True if the address is a "no address", aka homeless person, ...
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private bool $isNoAddress = false;
|
||||
|
||||
/**
|
||||
@@ -160,28 +150,25 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private ?ThirdParty $linkedToThirdParty = null;
|
||||
|
||||
/**
|
||||
* A geospatial field storing the coordinates of the Address.
|
||||
*
|
||||
* @ORM\Column(type="point", nullable=true)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private ?Point $point = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private ?PostalCode $postcode = null;
|
||||
|
||||
/**
|
||||
@@ -198,23 +185,20 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $steps = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $street = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private string $streetNumber = '';
|
||||
|
||||
/**
|
||||
@@ -222,9 +206,8 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* of address. By default, the current date.
|
||||
*
|
||||
* @ORM\Column(type="date")
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private \DateTime $validFrom;
|
||||
|
||||
/**
|
||||
@@ -232,9 +215,8 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* of address.
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
private ?\DateTime $validTo = null;
|
||||
|
||||
public function __construct()
|
||||
|
@@ -42,16 +42,14 @@ class AddressReference
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?\DateTimeImmutable $deletedAt = null;
|
||||
|
||||
/**
|
||||
@@ -60,67 +58,58 @@ class AddressReference
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private string $municipalityCode = '';
|
||||
|
||||
/**
|
||||
* A geospatial field storing the coordinates of the Address.
|
||||
*
|
||||
* @ORM\Column(type="point")
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?Point $point = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?PostalCode $postcode = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private string $refId = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private string $source = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private string $street = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private string $streetNumber = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
public function getCreatedAt(): ?\DateTimeImmutable
|
||||
|
@@ -39,16 +39,14 @@ class Center implements HasCenterInterface, \Stringable
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255)
|
||||
*
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
private string $name = '';
|
||||
|
||||
/**
|
||||
|
@@ -18,25 +18,22 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
* @ORM\Table(name="chill_main_civility")
|
||||
*
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={"chill_main_civility": Civility::class})
|
||||
*/
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_civility' => Civility::class])]
|
||||
class Civility
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
private array $abbreviation = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $active = true;
|
||||
|
||||
/**
|
||||
@@ -45,18 +42,16 @@ class Civility
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
|
@@ -31,10 +31,9 @@ class Country
|
||||
/**
|
||||
* @ORM\Column(type="string", length=3)
|
||||
*
|
||||
* @groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private string $countryCode = '';
|
||||
|
||||
/**
|
||||
@@ -43,9 +42,8 @@ class Country
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
@@ -53,10 +51,9 @@ class Country
|
||||
*
|
||||
* @ORM\Column(type="json")
|
||||
*
|
||||
* @groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private array $name = [];
|
||||
|
||||
public function getCountryCode(): string
|
||||
|
@@ -28,27 +28,22 @@ class DashboardConfigItem
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"dashboardConfigItem:read", "read"})
|
||||
*/
|
||||
#[Serializer\Groups(['dashboardConfigItem:read', 'read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*
|
||||
* @Serializer\Groups({"dashboardConfigItem:read", "read"})
|
||||
*
|
||||
* @Assert\NotNull
|
||||
*/
|
||||
#[Serializer\Groups(['dashboardConfigItem:read', 'read'])]
|
||||
#[Assert\NotNull]
|
||||
private string $type = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*
|
||||
* @Serializer\Groups({"dashboardConfigItem:read", "read"})
|
||||
*
|
||||
* @Assert\NotNull
|
||||
*/
|
||||
#[Serializer\Groups(['dashboardConfigItem:read', 'read'])]
|
||||
#[Assert\NotNull]
|
||||
private string $position = '';
|
||||
|
||||
/**
|
||||
@@ -58,9 +53,8 @@ class DashboardConfigItem
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", options={"default": "[]", "jsonb": true})
|
||||
*
|
||||
* @Serializer\Groups({"dashboardConfigItem:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['dashboardConfigItem:read'])]
|
||||
private array $metadata = [];
|
||||
|
||||
public function getId(): ?int
|
||||
|
@@ -25,33 +25,29 @@ class SimpleGeographicalUnitDTO
|
||||
* @readonly
|
||||
*
|
||||
* @psalm-readonly
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public int $id,
|
||||
/**
|
||||
* @readonly
|
||||
*
|
||||
* @psalm-readonly
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public string $unitName,
|
||||
/**
|
||||
* @readonly
|
||||
*
|
||||
* @psalm-readonly
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public string $unitRefId,
|
||||
/**
|
||||
* @readonly
|
||||
*
|
||||
* @psalm-readonly
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public int $layerId
|
||||
) {}
|
||||
}
|
||||
|
@@ -32,23 +32,20 @@ class GeographicalUnitLayer
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", nullable=false, options={"default": "[]"})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private string $refId = '';
|
||||
|
||||
/**
|
||||
|
@@ -31,9 +31,8 @@ class Language
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\Column(type="string")
|
||||
*
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
private ?string $id = null;
|
||||
|
||||
/**
|
||||
@@ -41,10 +40,9 @@ class Language
|
||||
*
|
||||
* @ORM\Column(type="json")
|
||||
*
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
|
@@ -24,55 +24,46 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
* @ORM\Table(name="chill_main_location")
|
||||
*
|
||||
* @ORM\Entity(repositoryClass=LocationRepository::class)
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "location": Location::class
|
||||
* })
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['location' => Location::class])]
|
||||
class Location implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $active = true;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Address::class, cascade={"persist"})
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?Address $address = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $availableForUsers = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?User $createdBy = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?string $email = null;
|
||||
|
||||
/**
|
||||
@@ -81,57 +72,50 @@ class Location implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=LocationType::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?LocationType $locationType = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?string $name = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="phone_number", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*
|
||||
* @PhonenumberConstraint(type="any")
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?PhoneNumber $phonenumber1 = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="phone_number", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*
|
||||
* @PhonenumberConstraint(type="any")
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?PhoneNumber $phonenumber2 = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
public function getActive(): ?bool
|
||||
|
@@ -21,13 +21,9 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
* @ORM\Table(name="chill_main_location_type")
|
||||
*
|
||||
* @ORM\Entity(repositoryClass=LocationTypeRepository::class)
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "location-type": LocationType::class
|
||||
* })
|
||||
*
|
||||
* @UniqueEntity({"defaultFor"})
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['location-type' => LocationType::class])]
|
||||
#[UniqueEntity(['defaultFor'])]
|
||||
class LocationType
|
||||
{
|
||||
final public const DEFAULT_FOR_3PARTY = 'thirdparty';
|
||||
@@ -42,44 +38,38 @@ class LocationType
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $active = true;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=32, options={"default": "optional"})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private string $addressRequired = self::STATUS_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $availableForUsers = true;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=32, options={"default": "optional"})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private string $contactData = self::STATUS_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=true, length=32, unique=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?string $defaultFor = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $editableByUsers = true;
|
||||
|
||||
/**
|
||||
@@ -88,18 +78,16 @@ class LocationType
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
private array $title = [];
|
||||
|
||||
public function getActive(): ?bool
|
||||
|
@@ -36,49 +36,38 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @Assert\NotBlank
|
||||
*
|
||||
* @Assert\NotNull
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
#[Assert\NotBlank]
|
||||
#[Assert\NotNull]
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @Assert\NotBlank
|
||||
*
|
||||
* @Assert\NotNull
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
#[Assert\NotBlank]
|
||||
#[Assert\NotNull]
|
||||
private string $content = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=false)
|
||||
*
|
||||
* @Assert\NotNull
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Assert\NotNull]
|
||||
#[Groups(['read'])]
|
||||
private ?\DateTimeImmutable $startDate = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
*
|
||||
* @Assert\GreaterThanOrEqual(propertyPath="startDate")
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate')]
|
||||
#[Groups(['read'])]
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
public function getTitle(): string
|
||||
|
@@ -116,9 +116,8 @@ class Notification implements TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", options={"default": ""})
|
||||
*
|
||||
* @Assert\NotBlank(message="notification.Title must be defined")
|
||||
*/
|
||||
#[Assert\NotBlank(message: 'notification.Title must be defined')]
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
@@ -187,10 +186,9 @@ class Notification implements TrackUpdateInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*
|
||||
* @param array $payload
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function assertCountAddresses(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
if (0 === (\count($this->getAddressesEmails()) + \count($this->getAddressees()))) {
|
||||
|
@@ -29,9 +29,8 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Assert\NotBlank(message="notification.Comment content might not be blank")
|
||||
*/
|
||||
#[Assert\NotBlank(message: 'notification.Comment content might not be blank')]
|
||||
private string $content = '';
|
||||
|
||||
/**
|
||||
|
@@ -56,23 +56,20 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="point", nullable=true)
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?Point $center = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=100)
|
||||
*
|
||||
* @groups({"write", "read"})
|
||||
*/
|
||||
#[Groups(['write', 'read'])]
|
||||
private ?string $code = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
|
||||
*
|
||||
* @groups({"write", "read"})
|
||||
*/
|
||||
#[Groups(['write', 'read'])]
|
||||
private ?Country $country = null;
|
||||
|
||||
/**
|
||||
@@ -86,37 +83,32 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @groups({"write", "read"})
|
||||
*/
|
||||
#[Groups(['write', 'read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, name="label")
|
||||
*
|
||||
* @groups({"write", "read"})
|
||||
*/
|
||||
#[Groups(['write', 'read'])]
|
||||
private ?string $name = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="origin", type="integer", nullable=true)
|
||||
*
|
||||
* @groups({"write", "read"})
|
||||
*/
|
||||
#[Groups(['write', 'read'])]
|
||||
private int $origin = 0;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?string $postalCodeSource = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*
|
||||
* @groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?string $refPostalCodeId = null;
|
||||
|
||||
public function getCenter(): ?Point
|
||||
|
@@ -33,9 +33,8 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
#[Assert\NotBlank]
|
||||
private string $description = '';
|
||||
|
||||
/**
|
||||
@@ -59,9 +58,8 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
#[Assert\NotBlank]
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
|
@@ -24,11 +24,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||
* @ORM\Table(name="scopes")
|
||||
*
|
||||
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "scope": Scope::class
|
||||
* })
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['scope' => Scope::class])]
|
||||
class Scope
|
||||
{
|
||||
/**
|
||||
@@ -42,9 +39,8 @@ class Scope
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
@@ -52,10 +48,9 @@ class Scope
|
||||
*
|
||||
* @ORM\Column(type="json")
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
|
@@ -33,11 +33,8 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
|
||||
* @ORM\Table(name="users")
|
||||
*
|
||||
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "user": User::class
|
||||
* })
|
||||
*/
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user' => User::class])]
|
||||
class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -18,11 +18,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @ORM\Table("chill_main_user_job")
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "user_job": UserJob::class
|
||||
* })
|
||||
*/
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user_job' => UserJob::class])]
|
||||
class UserJob
|
||||
{
|
||||
/**
|
||||
@@ -36,9 +33,8 @@ class UserJob
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
protected ?int $id = null;
|
||||
|
||||
/**
|
||||
@@ -46,10 +42,9 @@ class UserJob
|
||||
*
|
||||
* @ORM\Column(name="label", type="json")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
protected array $label = [];
|
||||
|
||||
public function getId(): ?int
|
||||
|
@@ -29,11 +29,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
* @ORM\Table("chill_main_workflow_entity")
|
||||
*
|
||||
* @EntityWorkflowCreation(groups={"creation"})
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "entity_workflow": EntityWorkflow::class
|
||||
* })
|
||||
*/
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['entity_workflow' => EntityWorkflow::class])]
|
||||
class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
@@ -100,10 +97,9 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
*
|
||||
* @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"})
|
||||
*
|
||||
* @Assert\Valid(traverse=true)
|
||||
*
|
||||
* @var Collection<EntityWorkflowStep>
|
||||
*/
|
||||
#[Assert\Valid(traverse: true)]
|
||||
private Collection $steps;
|
||||
|
||||
/**
|
||||
|
@@ -413,9 +413,7 @@ class EntityWorkflowStep
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validateOnCreation(ExecutionContextInterface $context, mixed $payload): void
|
||||
{
|
||||
return;
|
||||
|
@@ -28,7 +28,7 @@ class AddressDataMapper implements DataMapperInterface
|
||||
* @param Address $address
|
||||
* @param \Iterator $forms
|
||||
*/
|
||||
public function mapDataToForms($address, iterable $forms)
|
||||
public function mapDataToForms($address, \Traversable $forms)
|
||||
{
|
||||
if (null === $address) {
|
||||
return;
|
||||
@@ -78,7 +78,7 @@ class AddressDataMapper implements DataMapperInterface
|
||||
* @param \Iterator $forms
|
||||
* @param Address $address
|
||||
*/
|
||||
public function mapFormsToData(iterable $forms, &$address)
|
||||
public function mapFormsToData(\Traversable $forms, &$address)
|
||||
{
|
||||
if (!$address instanceof Address) {
|
||||
$address = new Address();
|
||||
|
@@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface;
|
||||
|
||||
final readonly class ExportPickCenterDataMapper implements DataMapperInterface
|
||||
{
|
||||
public function mapDataToForms($viewData, iterable $forms): void
|
||||
public function mapDataToForms($viewData, \Traversable $forms): void
|
||||
{
|
||||
if (null === $viewData) {
|
||||
return;
|
||||
@@ -31,7 +31,7 @@ final readonly class ExportPickCenterDataMapper implements DataMapperInterface
|
||||
// NOTE: we do not map back the regroupments
|
||||
}
|
||||
|
||||
public function mapFormsToData(iterable $forms, &$viewData): void
|
||||
public function mapFormsToData(\Traversable $forms, &$viewData): void
|
||||
{
|
||||
/** @var array<string, FormInterface> $forms */
|
||||
$forms = iterator_to_array($forms);
|
||||
|
@@ -21,7 +21,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI
|
||||
{
|
||||
public function __construct(private readonly Security $security) {}
|
||||
|
||||
public function mapDataToForms($viewData, iterable $forms)
|
||||
public function mapDataToForms($viewData, \Traversable $forms)
|
||||
{
|
||||
if (null === $viewData) {
|
||||
return null;
|
||||
@@ -36,7 +36,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI
|
||||
$forms['comments']->setData($viewData->getCommentForUser($this->security->getUser()));
|
||||
}
|
||||
|
||||
public function mapFormsToData(iterable $forms, &$viewData)
|
||||
public function mapFormsToData(\Traversable $forms, &$viewData)
|
||||
{
|
||||
$forms = iterator_to_array($forms);
|
||||
|
||||
|
@@ -17,7 +17,7 @@ use Symfony\Component\Form\Exception;
|
||||
|
||||
class RollingDateDataMapper implements DataMapperInterface
|
||||
{
|
||||
public function mapDataToForms($viewData, iterable $forms)
|
||||
public function mapDataToForms($viewData, \Traversable $forms)
|
||||
{
|
||||
if (null === $viewData) {
|
||||
return;
|
||||
@@ -33,7 +33,7 @@ class RollingDateDataMapper implements DataMapperInterface
|
||||
$forms['fixedDate']->setData($viewData->getFixedDate());
|
||||
}
|
||||
|
||||
public function mapFormsToData(iterable $forms, &$viewData): void
|
||||
public function mapFormsToData(\Traversable $forms, &$viewData): void
|
||||
{
|
||||
$forms = iterator_to_array($forms);
|
||||
|
||||
|
@@ -18,7 +18,7 @@ class ScopePickerDataMapper implements DataMapperInterface
|
||||
{
|
||||
public function __construct(private readonly ?Scope $scope = null) {}
|
||||
|
||||
public function mapDataToForms($data, iterable $forms)
|
||||
public function mapDataToForms($data, \Traversable $forms)
|
||||
{
|
||||
$forms = iterator_to_array($forms);
|
||||
|
||||
@@ -37,7 +37,7 @@ class ScopePickerDataMapper implements DataMapperInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function mapFormsToData(iterable $forms, &$data)
|
||||
public function mapFormsToData(\Traversable $forms, &$data)
|
||||
{
|
||||
$forms = iterator_to_array($forms);
|
||||
|
||||
|
@@ -17,7 +17,6 @@ use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
@@ -32,12 +31,12 @@ class UserPasswordType extends AbstractType
|
||||
protected $chillLogger;
|
||||
|
||||
/**
|
||||
* @var UserPasswordEncoderInterface
|
||||
* @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface
|
||||
*/
|
||||
protected $passwordEncoder;
|
||||
|
||||
public function __construct(
|
||||
UserPasswordEncoderInterface $passwordEncoder,
|
||||
\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder,
|
||||
LoggerInterface $chillLogger
|
||||
) {
|
||||
$this->passwordEncoder = $passwordEncoder;
|
||||
|
@@ -19,17 +19,13 @@ class SearchApiResult
|
||||
|
||||
public function __construct(private readonly float $relevance) {}
|
||||
|
||||
/**
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public function getRelevance(): float
|
||||
{
|
||||
return $this->relevance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public function getResult()
|
||||
{
|
||||
return $this->result;
|
||||
|
@@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||
|
||||
@@ -36,7 +35,7 @@ class UserProvider implements UserProviderInterface
|
||||
->setParameter('pattern', $username)
|
||||
->getSingleResult();
|
||||
} catch (NoResultException $e) {
|
||||
throw new UsernameNotFoundException('Bad credentials.', 0, $e);
|
||||
throw new \Symfony\Component\Security\Core\Exception\UserNotFoundException('Bad credentials.', 0, $e);
|
||||
}
|
||||
|
||||
return $user;
|
||||
@@ -51,7 +50,7 @@ class UserProvider implements UserProviderInterface
|
||||
$reloadedUser = $this->em->getRepository(User::class)->find($user->getId());
|
||||
|
||||
if (null === $reloadedUser) {
|
||||
throw new UsernameNotFoundException(sprintf('User with ID "%s" could not be reloaded.', $user->getId()));
|
||||
throw new \Symfony\Component\Security\Core\Exception\UserNotFoundException(sprintf('User with ID "%s" could not be reloaded.', $user->getId()));
|
||||
}
|
||||
|
||||
return $reloadedUser;
|
||||
|
@@ -16,7 +16,6 @@ use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -34,7 +33,7 @@ final class UserControllerTest extends WebTestCase
|
||||
|
||||
$user = new User();
|
||||
$user->setUsername('Test_user '.uniqid());
|
||||
$user->setPassword(self::getContainer()->get(UserPasswordEncoderInterface::class)->encodePassword(
|
||||
$user->setPassword(self::getContainer()->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class)->encodePassword(
|
||||
$user,
|
||||
'password'
|
||||
));
|
||||
@@ -138,9 +137,9 @@ final class UserControllerTest extends WebTestCase
|
||||
|
||||
protected function isPasswordValid($username, $password)
|
||||
{
|
||||
/** @var \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder */
|
||||
/** @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher $passwordEncoder */
|
||||
$passwordEncoder = self::getContainer()
|
||||
->get(UserPasswordEncoderInterface::class);
|
||||
->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class);
|
||||
|
||||
$user = self::getContainer()->get(UserRepositoryInterface::class)
|
||||
->findOneBy(['username' => $username]);
|
||||
|
Reference in New Issue
Block a user