Symfony 6.4 update (#590)
* symfony 6.3: removed sensio/framework-extra-bundle * symfony 6.3: update * Symfony 6.3.1 update * chore: composer up * symfony 6.4 update * cs: php-code-fixer update * fix composer.lock * add php-http required dependencies * Fix Stan and CS --------- Co-authored-by: Jérôme Tanghe <jerome.tanghe@les-tilleuls.coop>
This commit is contained in:
parent
bef9d299c0
commit
32d91e49a0
141 changed files with 4178 additions and 3165 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "APES : Platforme d'échange de services et de biens",
|
"description": "APES : Platforme d'échange de services et de biens",
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "beta",
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"repositories": {
|
"repositories": {
|
||||||
"coopTilleuls/payum-mollie": {
|
"coopTilleuls/payum-mollie": {
|
||||||
|
|
@ -44,51 +44,52 @@
|
||||||
"odolbeau/phone-number-bundle": "^3.9",
|
"odolbeau/phone-number-bundle": "^3.9",
|
||||||
"payum/offline": "^1.7",
|
"payum/offline": "^1.7",
|
||||||
"payum/payum-bundle": "^2.5",
|
"payum/payum-bundle": "^2.5",
|
||||||
|
"php-http/message": "^1.16",
|
||||||
|
"php-http/message-factory": "^1.1",
|
||||||
"phpdocumentor/reflection-docblock": "^5.3",
|
"phpdocumentor/reflection-docblock": "^5.3",
|
||||||
"phpstan/phpdoc-parser": "^1.11",
|
"phpstan/phpdoc-parser": "^1.11",
|
||||||
"sensio/framework-extra-bundle": "^6.2",
|
|
||||||
"snc/redis-bundle": "^4.3",
|
"snc/redis-bundle": "^4.3",
|
||||||
"stof/doctrine-extensions-bundle": "^1.7",
|
"stof/doctrine-extensions-bundle": "^1.7",
|
||||||
"symfony/asset": "6.2.*",
|
"symfony/asset": "6.4.*",
|
||||||
"symfony/cache": "6.2.*",
|
"symfony/cache": "6.4.*",
|
||||||
"symfony/clock": "6.2.*",
|
"symfony/clock": "6.4.*",
|
||||||
"symfony/console": "6.2.*",
|
"symfony/console": "6.4.*",
|
||||||
"symfony/doctrine-messenger": "6.2.*",
|
"symfony/doctrine-messenger": "6.4.*",
|
||||||
"symfony/dotenv": "6.2.*",
|
"symfony/dotenv": "6.4.*",
|
||||||
"symfony/expression-language": "6.2.*",
|
"symfony/expression-language": "6.4.*",
|
||||||
"symfony/fake-sms-notifier": "6.2.*",
|
"symfony/fake-sms-notifier": "6.4.*",
|
||||||
"symfony/flex": "^2",
|
"symfony/flex": "^2",
|
||||||
"symfony/form": "6.2.*",
|
"symfony/form": "6.4.*",
|
||||||
"symfony/framework-bundle": "6.2.*",
|
"symfony/framework-bundle": "6.4.*",
|
||||||
"symfony/google-mailer": "6.2.*",
|
"symfony/google-mailer": "6.4.*",
|
||||||
"symfony/html-sanitizer": "6.2.*",
|
"symfony/html-sanitizer": "6.4.*",
|
||||||
"symfony/http-client": "6.2.*",
|
"symfony/http-client": "6.4.*",
|
||||||
"symfony/mailer": "6.2.*",
|
"symfony/mailer": "6.4.*",
|
||||||
"symfony/mercure-bundle": "^0.3.5",
|
"symfony/mercure-bundle": "^0.3.5",
|
||||||
"symfony/messenger": "6.2.*",
|
"symfony/messenger": "6.4.*",
|
||||||
"symfony/mime": "6.2.*",
|
"symfony/mime": "6.4.*",
|
||||||
"symfony/monolog-bundle": "^3.8",
|
"symfony/monolog-bundle": "^3.8",
|
||||||
"symfony/notifier": "6.2.*",
|
"symfony/notifier": "6.4.*",
|
||||||
"symfony/ovh-cloud-notifier": "6.2.*",
|
"symfony/ovh-cloud-notifier": "6.4.*",
|
||||||
"symfony/property-access": "6.2.*",
|
"symfony/property-access": "6.4.*",
|
||||||
"symfony/property-info": "6.2.*",
|
"symfony/property-info": "6.4.*",
|
||||||
"symfony/proxy-manager-bridge": "6.2.*",
|
"symfony/proxy-manager-bridge": "6.4.*",
|
||||||
"symfony/rate-limiter": "6.2.*",
|
"symfony/rate-limiter": "6.4.*",
|
||||||
"symfony/requirements-checker": "^2.0",
|
"symfony/requirements-checker": "^2.0",
|
||||||
"symfony/runtime": "6.2.*",
|
"symfony/runtime": "6.4.*",
|
||||||
"symfony/security-bundle": "6.2.*",
|
"symfony/security-bundle": "6.4.*",
|
||||||
"symfony/serializer": "6.2.*",
|
"symfony/serializer": "6.4.*",
|
||||||
"symfony/stimulus-bundle": "^2.14",
|
"symfony/stimulus-bundle": "^2.14",
|
||||||
"symfony/translation-contracts": "^3.2",
|
"symfony/translation-contracts": "^3.2",
|
||||||
"symfony/twig-bridge": "6.2.*",
|
"symfony/twig-bridge": "6.4.*",
|
||||||
"symfony/twig-bundle": "6.2.*",
|
"symfony/twig-bundle": "6.4.*",
|
||||||
"symfony/twilio-notifier": "6.2.*",
|
"symfony/twilio-notifier": "6.4.*",
|
||||||
"symfony/uid": "6.2.*",
|
"symfony/uid": "6.4.*",
|
||||||
"symfony/ux-autocomplete": "^2.7",
|
"symfony/ux-autocomplete": "^2.7",
|
||||||
"symfony/validator": "6.2.*",
|
"symfony/validator": "6.4.*",
|
||||||
"symfony/webpack-encore-bundle": "^1.16",
|
"symfony/webpack-encore-bundle": "^1.16",
|
||||||
"symfony/workflow": "6.2.*",
|
"symfony/workflow": "6.4.*",
|
||||||
"symfony/yaml": "6.2.*",
|
"symfony/yaml": "6.4.*",
|
||||||
"twig/cssinliner-extra": "^3.4",
|
"twig/cssinliner-extra": "^3.4",
|
||||||
"twig/extra-bundle": "^3.4",
|
"twig/extra-bundle": "^3.4",
|
||||||
"twig/inky-extra": "^3.4",
|
"twig/inky-extra": "^3.4",
|
||||||
|
|
@ -152,7 +153,7 @@
|
||||||
"extra": {
|
"extra": {
|
||||||
"symfony": {
|
"symfony": {
|
||||||
"allow-contrib": false,
|
"allow-contrib": false,
|
||||||
"require": "6.2.*",
|
"require": "6.4.*",
|
||||||
"docker": true
|
"docker": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -169,13 +170,13 @@
|
||||||
"phpunit/phpunit": "^9.5",
|
"phpunit/phpunit": "^9.5",
|
||||||
"rector/rector": "^0.14.5",
|
"rector/rector": "^0.14.5",
|
||||||
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
|
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
|
||||||
"symfony/browser-kit": "6.2.*",
|
"symfony/browser-kit": "6.4.*",
|
||||||
"symfony/css-selector": "6.2.*",
|
"symfony/css-selector": "6.4.*",
|
||||||
"symfony/debug-bundle": "6.2.*",
|
"symfony/debug-bundle": "6.4.*",
|
||||||
"symfony/maker-bundle": "^1.47",
|
"symfony/maker-bundle": "^1.47",
|
||||||
"symfony/panther": "^2.0",
|
"symfony/panther": "^2.0",
|
||||||
"symfony/phpunit-bridge": "^6.1",
|
"symfony/phpunit-bridge": "^6.1",
|
||||||
"symfony/web-profiler-bundle": "6.2.*",
|
"symfony/web-profiler-bundle": "6.4.*",
|
||||||
"zenstruck/messenger-test": "^1.5"
|
"zenstruck/messenger-test": "^1.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6621
composer.lock
generated
6621
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -28,7 +28,6 @@ return [
|
||||||
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||||
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
|
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
|
||||||
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
|
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
|
||||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
|
||||||
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
|
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
|
||||||
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
|
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
|
||||||
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
|
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# https://stackoverflow.com/q/69809320/633864
|
|
||||||
sensio_framework_extra:
|
|
||||||
router:
|
|
||||||
annotations: false
|
|
||||||
request:
|
|
||||||
converters: false
|
|
||||||
auto_convert: false
|
|
||||||
|
|
@ -69,7 +69,7 @@ final class EndMembershipCommand extends Command
|
||||||
/** @var UserGroup $userGroup */
|
/** @var UserGroup $userGroup */
|
||||||
$user = $userGroup->getUser();
|
$user = $userGroup->getUser();
|
||||||
$group = $userGroup->getGroup();
|
$group = $userGroup->getGroup();
|
||||||
$io->comment(sprintf(' > deleting membership for %s of %s (%s) (%s)',
|
$io->comment(\sprintf(' > deleting membership for %s of %s (%s) (%s)',
|
||||||
$group->getName(),
|
$group->getName(),
|
||||||
$user->getDisplayName(),
|
$user->getDisplayName(),
|
||||||
$userGroup->getMembership()->value,
|
$userGroup->getMembership()->value,
|
||||||
|
|
@ -88,7 +88,7 @@ final class EndMembershipCommand extends Command
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
|
|
||||||
$io->note(sprintf(' > %d deletion(s) done.', $count));
|
$io->note(\sprintf(' > %d deletion(s) done.', $count));
|
||||||
$this->memoryReport($io);
|
$this->memoryReport($io);
|
||||||
$this->done($io);
|
$this->done($io);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ final class NotifyMembershipExpirationCommand extends Command
|
||||||
$days = $input->getArgument('days');
|
$days = $input->getArgument('days');
|
||||||
$days = max(1, (int) $days);
|
$days = max(1, (int) $days);
|
||||||
|
|
||||||
$io->section(sprintf('Getting membership expiring in %d days...', $days));
|
$io->section(\sprintf('Getting membership expiring in %d days...', $days));
|
||||||
$query = $this->userGroupRepository->getExpiring($days);
|
$query = $this->userGroupRepository->getExpiring($days);
|
||||||
$io->section('Sending notificaitons...');
|
$io->section('Sending notificaitons...');
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
@ -72,7 +72,7 @@ final class NotifyMembershipExpirationCommand extends Command
|
||||||
/** @var UserGroup $userGroup */
|
/** @var UserGroup $userGroup */
|
||||||
$user = $userGroup->getUser();
|
$user = $userGroup->getUser();
|
||||||
$group = $userGroup->getGroup();
|
$group = $userGroup->getGroup();
|
||||||
$io->comment(sprintf(' > notifying membership for %s of %s/%s (%s) (%s)',
|
$io->comment(\sprintf(' > notifying membership for %s of %s/%s (%s) (%s)',
|
||||||
$group->getName(),
|
$group->getName(),
|
||||||
$user->getDisplayName(),
|
$user->getDisplayName(),
|
||||||
$userGroup->getEndAt()?->format('Y-m-d'),
|
$userGroup->getEndAt()?->format('Y-m-d'),
|
||||||
|
|
@ -88,7 +88,7 @@ final class NotifyMembershipExpirationCommand extends Command
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
|
|
||||||
$io->note(sprintf(' > %d notification(s) sent.', $count));
|
$io->note(\sprintf(' > %d notification(s) sent.', $count));
|
||||||
|
|
||||||
$this->memoryReport($io);
|
$this->memoryReport($io);
|
||||||
$this->done($io);
|
$this->done($io);
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ final class NotifyServiceRequestDatesCommand extends Command
|
||||||
$serviceRequest->getStartAt() :
|
$serviceRequest->getStartAt() :
|
||||||
$serviceRequest->getEndAt()
|
$serviceRequest->getEndAt()
|
||||||
;
|
;
|
||||||
$io->comment(sprintf(' > notifying owner and recipient for service request %s (%s) starting on %s.',
|
$io->comment(\sprintf(' > notifying owner and recipient for service request %s (%s) starting on %s.',
|
||||||
$serviceRequest->getId(),
|
$serviceRequest->getId(),
|
||||||
$serviceRequest->getStatus()->value,
|
$serviceRequest->getStatus()->value,
|
||||||
$referenceDate->format('Y-m-d')
|
$referenceDate->format('Y-m-d')
|
||||||
|
|
@ -106,7 +106,7 @@ final class NotifyServiceRequestDatesCommand extends Command
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
|
|
||||||
$io->note(sprintf(' > %d notification(s) sent.', $count * 2)); // owner and recipient
|
$io->note(\sprintf(' > %d notification(s) sent.', $count * 2)); // owner and recipient
|
||||||
|
|
||||||
$this->memoryReport($io);
|
$this->memoryReport($io);
|
||||||
$this->done($io);
|
$this->done($io);
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ abstract class AbstractCategoryCrudController extends AbstractCrudController imp
|
||||||
$idField,
|
$idField,
|
||||||
$createdAt,
|
$createdAt,
|
||||||
$updatedAt,
|
$updatedAt,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveUp(AdminContext $context): Response
|
public function moveUp(AdminContext $context): Response
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,18 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All /admin routes are protected at the security.yaml level.
|
* All /admin routes are protected at the security.yaml level.
|
||||||
|
* ROLE_ADMIN inherits the ROLE_GROUP_ADMIN role.
|
||||||
|
*
|
||||||
|
* @see security.yaml
|
||||||
*/
|
*/
|
||||||
#[Security("is_granted('".User::ROLE_ADMIN."') or is_granted('".User::ROLE_GROUP_ADMIN."')")]
|
#[IsGranted(User::ROLE_GROUP_ADMIN)]
|
||||||
final class DashboardController extends AbstractDashboardController
|
final class DashboardController extends AbstractDashboardController
|
||||||
{
|
{
|
||||||
public const DOMAIN = 'admin';
|
public const DOMAIN = 'admin';
|
||||||
|
|
@ -60,7 +63,7 @@ final class DashboardController extends AbstractDashboardController
|
||||||
private readonly AdminUrlGenerator $adminUrlGenerator,
|
private readonly AdminUrlGenerator $adminUrlGenerator,
|
||||||
private readonly AuthorizationChecker $authorizationChecker,
|
private readonly AuthorizationChecker $authorizationChecker,
|
||||||
private readonly UserRepository $userRepository,
|
private readonly UserRepository $userRepository,
|
||||||
private readonly ServiceRequestRepository $requestRepository
|
private readonly ServiceRequestRepository $requestRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,8 +162,8 @@ final class DashboardController extends AbstractDashboardController
|
||||||
yield MenuItem::linkToCrud('menu.pages', 'fas fa-hat-wizard', Page::class)->setPermission(User::ROLE_ADMIN);
|
yield MenuItem::linkToCrud('menu.pages', 'fas fa-hat-wizard', Page::class)->setPermission(User::ROLE_ADMIN);
|
||||||
|
|
||||||
yield MenuItem::subMenu('menu.categories', 'fa-solid fa-folder')->setSubItems([
|
yield MenuItem::subMenu('menu.categories', 'fa-solid fa-folder')->setSubItems([
|
||||||
MenuItem::linkToUrl('menu.objects', 'fa-solid fa-box', $categoryObjectUrl)->setPermission(User::ROLE_ADMIN),
|
MenuItem::linkToUrl('menu.objects', 'fa-solid fa-box', $categoryObjectUrl)->setPermission(User::ROLE_ADMIN),
|
||||||
MenuItem::linkToUrl('menu.services', 'fa-regular fa-handshake', $categoryServiceUrl)->setPermission(User::ROLE_ADMIN),
|
MenuItem::linkToUrl('menu.services', 'fa-regular fa-handshake', $categoryServiceUrl)->setPermission(User::ROLE_ADMIN),
|
||||||
])->setPermission(User::ROLE_ADMIN);
|
])->setPermission(User::ROLE_ADMIN);
|
||||||
|
|
||||||
// —————————————————————————————————————————————————————————————————————
|
// —————————————————————————————————————————————————————————————————————
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ final class GroupCrudController extends AbstractCrudController implements GroupA
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
private readonly FilterFactory $filterFactory,
|
private readonly FilterFactory $filterFactory,
|
||||||
private readonly SluggerInterface $slugger,
|
private readonly SluggerInterface $slugger,
|
||||||
private readonly ConfigurationRepository $configurationRepository
|
private readonly ConfigurationRepository $configurationRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ final class GroupCrudController extends AbstractCrudController implements GroupA
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$qb->andWhere(sprintf('%s.id IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
$qb->andWhere(\sprintf('%s.id IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||||
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ final class GroupOfferCrudController extends AbstractCrudController implements G
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$qb->andWhere(sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
$qb->andWhere(\sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||||
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ final class UserGroupCrudController extends AbstractCrudController implements Gr
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$qb->andWhere(sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
$qb->andWhere(\sprintf('%s.group IN (:groups)', $qb->getRootAliases()[0] ?? ''))
|
||||||
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
->setParameter(':groups', $user->getMyGroupsAsAdmin());
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ final class CreateGroupAction extends AbstractController
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route([
|
#[Route([
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/groups/create-my-group',
|
'en' => MyAccountAction::BASE_URL_EN.'/groups/create-my-group',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/groupes/creer-mon-groupe',
|
'fr' => MyAccountAction::BASE_URL_FR.'/groupes/creer-mon-groupe',
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ trait PaginationTrait
|
||||||
*
|
*
|
||||||
* @implements PaginationInterface<int,Product>
|
* @implements PaginationInterface<int,Product>
|
||||||
*
|
*
|
||||||
* @return PaginationInterface<int,Product>
|
* @return PaginationInterface<int,mixed>
|
||||||
*/
|
*/
|
||||||
private function paginate(SearchResult $searchResult): PaginationInterface
|
private function paginate(SearchResult $searchResult): PaginationInterface
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ final class AddressController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @see UserAddressQueryHandler
|
* @see UserAddressQueryHandler
|
||||||
*/
|
*/
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/my-address/step-1',
|
'en' => MyAccountAction::BASE_URL_EN.'/my-address/step-1',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/mon-adresse/etape-1',
|
'fr' => MyAccountAction::BASE_URL_FR.'/mon-adresse/etape-1',
|
||||||
|
|
@ -75,7 +75,7 @@ final class AddressController extends AbstractController
|
||||||
return $this->render('pages/account/address/step1.html.twig', compact('form'));
|
return $this->render('pages/account/address/step1.html.twig', compact('form'));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/my-address/step-2',
|
'en' => MyAccountAction::BASE_URL_EN.'/my-address/step-2',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/mon-adresse/etape-2',
|
'fr' => MyAccountAction::BASE_URL_FR.'/mon-adresse/etape-2',
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
/**
|
/**
|
||||||
* @see UserGroupControllerTest
|
* @see UserGroupControllerTest
|
||||||
*/
|
*/
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
final class UserGroupController extends AbstractController
|
final class UserGroupController extends AbstractController
|
||||||
{
|
{
|
||||||
use SecurityTrait;
|
use SecurityTrait;
|
||||||
|
|
@ -39,7 +39,7 @@ final class UserGroupController extends AbstractController
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly QueryBus $queryBus,
|
private readonly QueryBus $queryBus,
|
||||||
private readonly CommandBus $commandBus
|
private readonly CommandBus $commandBus,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ final class MyAccountAction extends AbstractController
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => self::BASE_URL_EN,
|
'en' => self::BASE_URL_EN,
|
||||||
'fr' => self::BASE_URL_FR,
|
'fr' => self::BASE_URL_FR,
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ final class DeleteProductUnavailabilityAction extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/products/unavailability/{id}/delete',
|
'en' => MyAccountAction::BASE_URL_EN.'/products/unavailability/{id}/delete',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/produits/indisponibilite/{id}/supprimer',
|
'fr' => MyAccountAction::BASE_URL_FR.'/produits/indisponibilite/{id}/supprimer',
|
||||||
],
|
],
|
||||||
name: 'app_user_product_delete_availability',
|
name: 'app_user_product_delete_availability',
|
||||||
requirements: [
|
requirements: [
|
||||||
'id' => Requirement::UUID_V6,
|
'id' => Requirement::UUID_V6,
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,13 @@ final class ProductAvailabilityController extends AbstractController
|
||||||
public const ROUTE = 'app_user_product_availabilities';
|
public const ROUTE = 'app_user_product_availabilities';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public readonly ProductRepository $productRepository,
|
public readonly ProductRepository $productRepository,
|
||||||
private readonly QueryBus $queryBus,
|
private readonly QueryBus $queryBus,
|
||||||
private readonly CommandBus $commandBus,
|
private readonly CommandBus $commandBus,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/my-products/{id}/availabilities',
|
'en' => MyAccountAction::BASE_URL_EN.'/my-products/{id}/availabilities',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/mes-produits/{id}/disponibilites',
|
'fr' => MyAccountAction::BASE_URL_FR.'/mes-produits/{id}/disponibilites',
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
/**
|
/**
|
||||||
* @see UserProductsControllerTest
|
* @see UserProductsControllerTest
|
||||||
*/
|
*/
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(name: 'app_user_')]
|
#[Route(name: 'app_user_')]
|
||||||
final class UserProductsController extends AbstractController
|
final class UserProductsController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
@ -49,7 +49,7 @@ final class UserProductsController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @implements PaginationInterface<int,Product>
|
* @implements PaginationInterface<int,Product>
|
||||||
*
|
*
|
||||||
* @return PaginationInterface<int,Product>
|
* @return PaginationInterface<int,mixed>
|
||||||
*/
|
*/
|
||||||
private function paginate(Query $query, int $page): PaginationInterface
|
private function paginate(Query $query, int $page): PaginationInterface
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
/**
|
/**
|
||||||
* @see ConversationControllerTest
|
* @see ConversationControllerTest
|
||||||
*/
|
*/
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
class ConversationController extends AbstractController
|
class ConversationController extends AbstractController
|
||||||
{
|
{
|
||||||
use FlashTrait;
|
use FlashTrait;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ final class MyLendingsAction extends AbstractController
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/my-lendings',
|
'en' => MyAccountAction::BASE_URL_EN.'/my-lendings',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/mes-prets',
|
'fr' => MyAccountAction::BASE_URL_FR.'/mes-prets',
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class MyLoansAction extends AbstractController
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
#[Route(path: [
|
#[Route(path: [
|
||||||
'en' => MyAccountAction::BASE_URL_EN.'/my-loans',
|
'en' => MyAccountAction::BASE_URL_EN.'/my-loans',
|
||||||
'fr' => MyAccountAction::BASE_URL_FR.'/mes-emprunts',
|
'fr' => MyAccountAction::BASE_URL_FR.'/mes-emprunts',
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use Symfony\Component\Uid\Uuid;
|
||||||
/**
|
/**
|
||||||
* @see ServiceRequestControllerTest
|
* @see ServiceRequestControllerTest
|
||||||
*/
|
*/
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
class ServiceRequestController extends AbstractController
|
class ServiceRequestController extends AbstractController
|
||||||
{
|
{
|
||||||
use FlashTrait;
|
use FlashTrait;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use function Symfony\Component\String\u;
|
||||||
/**
|
/**
|
||||||
* @see ServiceRequestStatusWorkflowControllerTest
|
* @see ServiceRequestStatusWorkflowControllerTest
|
||||||
*/
|
*/
|
||||||
#[isGranted(User::ROLE_USER)]
|
#[IsGranted(User::ROLE_USER)]
|
||||||
class ServiceRequestStatusWorkflowController extends AbstractController
|
class ServiceRequestStatusWorkflowController extends AbstractController
|
||||||
{
|
{
|
||||||
use FlashTrait;
|
use FlashTrait;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ trait i18nTrait
|
||||||
* Get the i18n prefix of a given class to have a consistent key naming in i18n
|
* Get the i18n prefix of a given class to have a consistent key naming in i18n
|
||||||
* files.
|
* files.
|
||||||
*/
|
*/
|
||||||
public function getI18nPrefix(string $class = null): string
|
public function getI18nPrefix(?string $class = null): string
|
||||||
{
|
{
|
||||||
$class = $class ?? $this::class;
|
$class = $class ?? $this::class;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
final class ValidationProcessor implements ProcessorInterface
|
final class ValidationProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ValidatorInterface $validator
|
private readonly ValidatorInterface $validator,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ final class ValidationProcessor implements ProcessorInterface
|
||||||
/** @var ConstraintViolationList $violations */
|
/** @var ConstraintViolationList $violations */
|
||||||
$violations = $this->validator->validate($object);
|
$violations = $this->validator->validate($object);
|
||||||
if ($violations->count() > 0) {
|
if ($violations->count() > 0) {
|
||||||
$message = sprintf("Error when validating fixture \"%s\", violation(s) detected:\n%s", $id, $violations);
|
$message = \sprintf("Error when validating fixture \"%s\", violation(s) detected:\n%s", $id, $violations);
|
||||||
throw new \DomainException($message);
|
throw new \DomainException($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use function Symfony\Component\String\u;
|
||||||
final class UserListener
|
final class UserListener
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly UserManager $userManager
|
private readonly UserManager $userManager,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ final class MessageManager
|
||||||
ServiceRequest $serviceRequest,
|
ServiceRequest $serviceRequest,
|
||||||
string $messageTemplate,
|
string $messageTemplate,
|
||||||
array $messageParameters = [],
|
array $messageParameters = [],
|
||||||
\DateTimeImmutable $createdAt = null,
|
?\DateTimeImmutable $createdAt = null,
|
||||||
): Message {
|
): Message {
|
||||||
$message = (new Message())
|
$message = (new Message())
|
||||||
->setServiceRequest($serviceRequest)
|
->setServiceRequest($serviceRequest)
|
||||||
|
|
@ -61,7 +61,7 @@ final class MessageManager
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createFromRecipientMessage(ServiceRequest $serviceRequest, string $message, \DateTimeImmutable $createdAt = null): Message
|
public function createFromRecipientMessage(ServiceRequest $serviceRequest, string $message, ?\DateTimeImmutable $createdAt = null): Message
|
||||||
{
|
{
|
||||||
$message = (new Message())
|
$message = (new Message())
|
||||||
->setServiceRequest($serviceRequest)
|
->setServiceRequest($serviceRequest)
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class ProductManager
|
||||||
try {
|
try {
|
||||||
$this->productStorage->delete($image);
|
$this->productStorage->delete($image);
|
||||||
} catch (FilesystemException $e) {
|
} catch (FilesystemException $e) {
|
||||||
$this->logger->warning(sprintf('Unable to delete product (%s) image %s: %s', $product->getId(), $image, $e->getMessage()));
|
$this->logger->warning(\sprintf('Unable to delete product (%s) image %s: %s', $product->getId(), $image, $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$product->deleteImage($image);
|
$product->deleteImage($image);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ final class UserManager
|
||||||
try {
|
try {
|
||||||
$this->userStorage->delete((string) $user->getAvatar());
|
$this->userStorage->delete((string) $user->getAvatar());
|
||||||
} catch (FilesystemException $e) {
|
} catch (FilesystemException $e) {
|
||||||
$this->logger->warning(sprintf('Unable to avatar of user (%s) image %s: %s', $user->getId(), $user->getAvatar(), $e->getMessage()));
|
$this->logger->warning(\sprintf('Unable to avatar of user (%s) image %s: %s', $user->getId(), $user->getAvatar(), $e->getMessage()));
|
||||||
}
|
}
|
||||||
$user->deleteAvatar();
|
$user->deleteAvatar();
|
||||||
$this->save($user, true);
|
$this->save($user, true);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use App\Form\Type\Product\SearchFormType;
|
||||||
*/
|
*/
|
||||||
final class Search
|
final class Search
|
||||||
{
|
{
|
||||||
public function __construct(string $q, int $page = 1, User $user = null)
|
public function __construct(string $q, int $page = 1, ?User $user = null)
|
||||||
{
|
{
|
||||||
$this->q = $q;
|
$this->q = $q;
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
|
|
@ -78,9 +78,9 @@ final class Search
|
||||||
*/
|
*/
|
||||||
public function hasProximity(): bool
|
public function hasProximity(): bool
|
||||||
{
|
{
|
||||||
return $this->hasCity() &&
|
return $this->hasCity()
|
||||||
($this->city?->hasLocality() ?? false) &&
|
&& ($this->city?->hasLocality() ?? false)
|
||||||
$this->hasDistance()
|
&& $this->hasDistance()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ trait FieldTrait
|
||||||
/**
|
/**
|
||||||
* Render the boolean without switch: ✅ ❌.
|
* Render the boolean without switch: ✅ ❌.
|
||||||
*/
|
*/
|
||||||
public function getSimpleBooleanField(string $propertyName, string $label = null): BooleanField
|
public function getSimpleBooleanField(string $propertyName, ?string $label = null): BooleanField
|
||||||
{
|
{
|
||||||
return BooleanField::new($propertyName, $label)
|
return BooleanField::new($propertyName, $label)
|
||||||
->renderAsSwitch(false)
|
->renderAsSwitch(false)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ final class EnumFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
use FilterTrait;
|
use FilterTrait;
|
||||||
|
|
||||||
public static function new(string $propertyName, string $formType, string $label = null): self
|
public static function new(string $propertyName, string $formType, ?string $label = null): self
|
||||||
{
|
{
|
||||||
return (new self())
|
return (new self())
|
||||||
->setFilterFqcn(__CLASS__)
|
->setFilterFqcn(__CLASS__)
|
||||||
|
|
@ -32,7 +32,7 @@ final class EnumFilter implements FilterInterface
|
||||||
*/
|
*/
|
||||||
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void
|
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void
|
||||||
{
|
{
|
||||||
$queryBuilder->andWhere(sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
$queryBuilder->andWhere(\sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
||||||
->setParameter('value', $filterDataDto->getValue());
|
->setParameter('value', $filterDataDto->getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ final class GroupFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
use FilterTrait;
|
use FilterTrait;
|
||||||
|
|
||||||
public static function new(string $propertyName, string $label = null): self
|
public static function new(string $propertyName, ?string $label = null): self
|
||||||
{
|
{
|
||||||
return (new self())
|
return (new self())
|
||||||
->setFilterFqcn(__CLASS__)
|
->setFilterFqcn(__CLASS__)
|
||||||
|
|
@ -37,7 +37,7 @@ final class GroupFilter implements FilterInterface
|
||||||
/** @var Group $group */
|
/** @var Group $group */
|
||||||
$group = $filterDataDto->getValue();
|
$group = $filterDataDto->getValue();
|
||||||
$queryBuilder
|
$queryBuilder
|
||||||
->innerJoin(sprintf('%s.userGroups', $filterDataDto->getEntityAlias()), 'ug')
|
->innerJoin(\sprintf('%s.userGroups', $filterDataDto->getEntityAlias()), 'ug')
|
||||||
->andWhere('ug.group = :group')
|
->andWhere('ug.group = :group')
|
||||||
->setParameter(':group', $group->getId())
|
->setParameter(':group', $group->getId())
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ final class MyUsersFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
use FilterTrait;
|
use FilterTrait;
|
||||||
|
|
||||||
public static function new(string $propertyName, string $label = null): self
|
public static function new(string $propertyName, ?string $label = null): self
|
||||||
{
|
{
|
||||||
return (new self())
|
return (new self())
|
||||||
->setFilterFqcn(__CLASS__)
|
->setFilterFqcn(__CLASS__)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ final class MyGroupFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
use FilterTrait;
|
use FilterTrait;
|
||||||
|
|
||||||
public static function new(string $propertyName, string $label = null): self
|
public static function new(string $propertyName, ?string $label = null): self
|
||||||
{
|
{
|
||||||
return (new self())
|
return (new self())
|
||||||
->setFilterFqcn(__CLASS__)
|
->setFilterFqcn(__CLASS__)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ final class UuidFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
use FilterTrait;
|
use FilterTrait;
|
||||||
|
|
||||||
public static function new(string $propertyName, string $label = null): self
|
public static function new(string $propertyName, ?string $label = null): self
|
||||||
{
|
{
|
||||||
return (new self())
|
return (new self())
|
||||||
->setFilterFqcn(__CLASS__)
|
->setFilterFqcn(__CLASS__)
|
||||||
|
|
@ -37,7 +37,7 @@ final class UuidFilter implements FilterInterface
|
||||||
*/
|
*/
|
||||||
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void
|
public function apply(QueryBuilder $queryBuilder, FilterDataDto $filterDataDto, ?FieldDto $fieldDto, EntityDto $entityDto): void
|
||||||
{
|
{
|
||||||
$queryBuilder->andWhere(sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
$queryBuilder->andWhere(\sprintf('%s.%s = :value', $filterDataDto->getEntityAlias(), $filterDataDto->getProperty()))
|
||||||
->setParameter('value', $filterDataDto->getValue());
|
->setParameter('value', $filterDataDto->getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class GroupType extends AbstractType
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Security $security,
|
private readonly Security $security,
|
||||||
private readonly AuthorizationChecker $authorizationChecker
|
private readonly AuthorizationChecker $authorizationChecker,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class UserType extends AbstractType
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Security $security,
|
private readonly Security $security,
|
||||||
private readonly AuthorizationChecker $authorizationChecker
|
private readonly AuthorizationChecker $authorizationChecker,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ class Address implements \Stringable
|
||||||
* OpenStreetMap identifier, usefull to create link to maps.
|
* OpenStreetMap identifier, usefull to create link to maps.
|
||||||
*/
|
*/
|
||||||
#[ORM\Column(type: Types::BIGINT, nullable: true)]
|
#[ORM\Column(type: Types::BIGINT, nullable: true)]
|
||||||
private int $osmId;
|
private string $osmId;
|
||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
|
|
@ -340,12 +340,12 @@ class Address implements \Stringable
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOsmId(): int
|
public function getOsmId(): string
|
||||||
{
|
{
|
||||||
return $this->osmId;
|
return $this->osmId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setOsmId(int $osmId): Address
|
public function setOsmId(string $osmId): Address
|
||||||
{
|
{
|
||||||
$this->osmId = $osmId;
|
$this->osmId = $osmId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,10 +266,10 @@ class Group implements \Stringable
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMembership(): GroupMembership
|
public function getMembership(): GroupMembership
|
||||||
{
|
{
|
||||||
return $this->membership;
|
return $this->membership;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMembership(GroupMembership $membership): void
|
public function setMembership(GroupMembership $membership): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -127,12 +127,12 @@ class Menu implements ImageInterface, \Stringable
|
||||||
public function removeItem(MenuItem $item): self
|
public function removeItem(MenuItem $item): self
|
||||||
{
|
{
|
||||||
$this->items->removeElement($item);
|
$this->items->removeElement($item);
|
||||||
// if ($this->items->removeElement($item)) {
|
// if ($this->items->removeElement($item)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
// if ($item->getMenu() === $this) {
|
// if ($item->getMenu() === $this) {
|
||||||
// $item->setMenu(null);
|
// $item->setMenu(null);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -487,9 +487,9 @@ class Product implements \Stringable, ImagesInterface
|
||||||
$resultArray = [];
|
$resultArray = [];
|
||||||
$today = CarbonImmutable::today(); // start of day 00:00:00
|
$today = CarbonImmutable::today(); // start of day 00:00:00
|
||||||
$unavailabilities = $this->getAvailabilities()->filter(
|
$unavailabilities = $this->getAvailabilities()->filter(
|
||||||
fn (ProductAvailability $pa) => $pa->getMode()->isUnavailable() && // of the good type
|
fn (ProductAvailability $pa) => $pa->getMode()->isUnavailable() // of the good type
|
||||||
($serviceRequest === null || $pa->getServiceRequest() !== $serviceRequest) && // exclude the dates of the current service request (modify dates)
|
&& ($serviceRequest === null || $pa->getServiceRequest() !== $serviceRequest) // exclude the dates of the current service request (modify dates)
|
||||||
$pa->getEndAt() >= $today // passed dates are useless but the start date can be in the past
|
&& $pa->getEndAt() >= $today // passed dates are useless but the start date can be in the past
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($unavailabilities as $unavailability) {
|
foreach ($unavailabilities as $unavailability) {
|
||||||
|
|
|
||||||
|
|
@ -605,10 +605,10 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, ImageIn
|
||||||
$this->category = $category;
|
$this->category = $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription(): ?string
|
public function getDescription(): ?string
|
||||||
{
|
{
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDescription(?string $description): void
|
public function setDescription(?string $description): void
|
||||||
{
|
{
|
||||||
|
|
@ -833,7 +833,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, ImageIn
|
||||||
UserType::USER => UserCrudController::class,
|
UserType::USER => UserCrudController::class,
|
||||||
UserType::ADMIN => AdministratorCrudController::class,
|
UserType::ADMIN => AdministratorCrudController::class,
|
||||||
UserType::PLACE => PlaceCrudController::class,
|
UserType::PLACE => PlaceCrudController::class,
|
||||||
default => throw new \LogicException('No type assigned to user yet.')
|
default => throw new \LogicException('No type assigned to user yet.'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class CreateGroupFormType extends AbstractType
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Security $security,
|
private readonly Security $security,
|
||||||
private readonly ConfigurationRepository $configurationRepository,
|
private readonly ConfigurationRepository $configurationRepository,
|
||||||
private readonly GroupRepository $groupRepository
|
private readonly GroupRepository $groupRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ final class ObjectFormType extends AbstractProductFormType
|
||||||
public function __construct(
|
public function __construct(
|
||||||
MediaManager $mediaManager,
|
MediaManager $mediaManager,
|
||||||
private readonly GroupRepository $groupRepository,
|
private readonly GroupRepository $groupRepository,
|
||||||
private readonly Security $security
|
private readonly Security $security,
|
||||||
) {
|
) {
|
||||||
parent::__construct($mediaManager, $security);
|
parent::__construct($mediaManager, $security);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ final class ServiceFormType extends AbstractProductFormType
|
||||||
public function __construct(
|
public function __construct(
|
||||||
MediaManager $mediaManager,
|
MediaManager $mediaManager,
|
||||||
private readonly GroupRepository $groupRepository,
|
private readonly GroupRepository $groupRepository,
|
||||||
private readonly Security $security
|
private readonly Security $security,
|
||||||
) {
|
) {
|
||||||
parent::__construct($mediaManager, $security);
|
parent::__construct($mediaManager, $security);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@ abstract class AbstractUserProductSelectFormType extends AbstractType
|
||||||
return $builder
|
return $builder
|
||||||
->setMethod('GET')
|
->setMethod('GET')
|
||||||
->add('product', EntityType::class, [
|
->add('product', EntityType::class, [
|
||||||
'class' => Product::class,
|
'class' => Product::class,
|
||||||
'query_builder' => function (EntityRepository $entityRepository) {
|
'query_builder' => function (EntityRepository $entityRepository) {
|
||||||
$qb = $entityRepository->createQueryBuilder('p')
|
$qb = $entityRepository->createQueryBuilder('p')
|
||||||
->from(ServiceRequest::class, 'sr')
|
->from(ServiceRequest::class, 'sr')
|
||||||
->andWhere('p = sr.product');
|
->andWhere('p = sr.product');
|
||||||
|
|
||||||
return $qb->andWhere(sprintf('sr.%s = :user', $this->isOwner() ? 'owner' : 'recipient'))
|
return $qb->andWhere(\sprintf('sr.%s = :user', $this->isOwner() ? 'owner' : 'recipient'))
|
||||||
->setParameter('user', $this->security->getUser());
|
->setParameter('user', $this->security->getUser());
|
||||||
},
|
},
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ final class NominatimToAddressAdapter
|
||||||
$address->setOsmType((string) $nominatimAddress->getOSMType());
|
$address->setOsmType((string) $nominatimAddress->getOSMType());
|
||||||
|
|
||||||
if ($nominatimAddress->getOSMId() !== null) {
|
if ($nominatimAddress->getOSMId() !== null) {
|
||||||
$address->setOsmId($nominatimAddress->getOSMId());
|
$address->setOsmId((string) $nominatimAddress->getOSMId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class GeoProvider implements GeoProviderInterface
|
||||||
/** @var AddressCollection $collection */
|
/** @var AddressCollection $collection */
|
||||||
$collection = $this->nominatimGeocoder->geocodeQuery($query);
|
$collection = $this->nominatimGeocoder->geocodeQuery($query);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new \RuntimeException(sprintf('Unable to get geoloc of %s: %s', $text, $e->getMessage()));
|
throw new \RuntimeException(\sprintf('Unable to get geoloc of %s: %s', $text, $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $collection;
|
return $collection;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ final class GroupInvitationEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +46,8 @@ final class GroupInvitationEmail implements EmailInterface
|
||||||
->to($user->getEmail())
|
->to($user->getEmail())
|
||||||
->priority(Email::PRIORITY_HIGH)
|
->priority(Email::PRIORITY_HIGH)
|
||||||
->subject($this->translator->trans($this->getI18nPrefix().'.subject', [
|
->subject($this->translator->trans($this->getI18nPrefix().'.subject', [
|
||||||
'%brand%' => $this->brand,
|
'%brand%' => $this->brand,
|
||||||
'%group%' => $group->getName(),
|
'%group%' => $group->getName(),
|
||||||
], AppMailer::TR_DOMAIN))
|
], AppMailer::TR_DOMAIN))
|
||||||
->htmlTemplate('email/admin/group/group_invitation.html.twig')
|
->htmlTemplate('email/admin/group/group_invitation.html.twig')
|
||||||
->context($context)
|
->context($context)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class NewAdminEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class PromoteToAdminEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ final class AdminPromotionEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ final class MainAdminPromotionEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ final class EndMembershipEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ final class NotifyMembershipExpirationEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ final class NotifyServiceRequestEndEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ final class NotifyServiceRequestStartEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ final class CreateAccountStep1Email implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,8 +53,8 @@ final class CreateAccountStep1Email implements EmailInterface
|
||||||
->to($user->getEmail())
|
->to($user->getEmail())
|
||||||
->priority(Email::PRIORITY_HIGH)
|
->priority(Email::PRIORITY_HIGH)
|
||||||
->subject($this->translator->trans($subjectKey, [
|
->subject($this->translator->trans($subjectKey, [
|
||||||
'%brand%' => $this->brand,
|
'%brand%' => $this->brand,
|
||||||
'%group%' => $group?->getName(),
|
'%group%' => $group?->getName(),
|
||||||
], AppMailer::TR_DOMAIN))
|
], AppMailer::TR_DOMAIN))
|
||||||
->htmlTemplate('email/security/create_account_step1.html.twig')
|
->htmlTemplate('email/security/create_account_step1.html.twig')
|
||||||
->context($context)
|
->context($context)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ final class NewMessageEmail implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ final class NewServiceRequest implements EmailInterface
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TranslatorInterface $translator,
|
private readonly TranslatorInterface $translator,
|
||||||
#[Autowire('%brand%')]
|
#[Autowire('%brand%')]
|
||||||
private readonly string $brand
|
private readonly string $brand,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,6 @@ abstract class AbstractFormCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \UnexpectedValueException(sprintf('Invalid property name, it should start with "%s"', implode(', ', $this->getSections())));
|
throw new \UnexpectedValueException(\sprintf('Invalid property name, it should start with "%s"', implode(', ', $this->getSections())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,6 @@ final class DuplicateProductCommand
|
||||||
|
|
||||||
// optionnal attribute to test
|
// optionnal attribute to test
|
||||||
public readonly ?string $attribute,
|
public readonly ?string $attribute,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,6 @@ final class CreateMessageCommand
|
||||||
|
|
||||||
// content of the message
|
// content of the message
|
||||||
public string $message,
|
public string $message,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,6 @@ final class CreateServiceRequestCommand
|
||||||
public readonly \DateTimeImmutable $endAt,
|
public readonly \DateTimeImmutable $endAt,
|
||||||
|
|
||||||
public ?string $message,
|
public ?string $message,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,6 @@ final class ReadMessagesCommand
|
||||||
|
|
||||||
// user who read the messages
|
// user who read the messages
|
||||||
public readonly Uuid $readerId,
|
public readonly Uuid $readerId,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ final class TryAutoFinalizeCommand
|
||||||
public function __construct(
|
public function __construct(
|
||||||
// related service request
|
// related service request
|
||||||
public readonly Uuid $requestServiceId,
|
public readonly Uuid $requestServiceId,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ final class CommandBus implements CommandBusInterface
|
||||||
use HandleTrait;
|
use HandleTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
MessageBusInterface $commandBus
|
MessageBusInterface $commandBus,
|
||||||
) {
|
) {
|
||||||
$this->messageBus = $commandBus;
|
$this->messageBus = $commandBus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ final class QueryBus implements QueryBusInterface
|
||||||
use HandleTrait;
|
use HandleTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
MessageBusInterface $queryBus
|
MessageBusInterface $queryBus,
|
||||||
) {
|
) {
|
||||||
$this->messageBus = $queryBus;
|
$this->messageBus = $queryBus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class DuplicateProductCommandHandler
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ProductRepository $productRepository,
|
private readonly ProductRepository $productRepository,
|
||||||
private readonly ProductManager $productManager,
|
private readonly ProductManager $productManager,
|
||||||
private readonly AuthorizationCheckerInterface $authorizationChecker
|
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ final class TryAutoFinalizeCommandHandler
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ServiceRequestRepository $serviceRequestRepository,
|
private readonly ServiceRequestRepository $serviceRequestRepository,
|
||||||
private readonly ServiceRequestManager $serviceRequestManager,
|
private readonly ServiceRequestManager $serviceRequestManager,
|
||||||
private readonly ServiceRequestStatusWorkflow $serviceRequestStatusWorkflow
|
private readonly ServiceRequestStatusWorkflow $serviceRequestStatusWorkflow,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
||||||
final class ParametersFormQueryHandler
|
final class ParametersFormQueryHandler
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ConfigurationRepository $configurationRepository
|
private readonly ConfigurationRepository $configurationRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ final class GetServiceRequestByIdQueryHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->security->isGranted(ServiceRequestVoter::VIEW, $serviceRequest)) {
|
if (!$this->security->isGranted(ServiceRequestVoter::VIEW, $serviceRequest)) {
|
||||||
throw new AccessDeniedException(sprintf('Access to service request "%s" denied (not owner or recipient).', $message->id));
|
throw new AccessDeniedException(\sprintf('Access to service request "%s" denied (not owner or recipient).', $message->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $serviceRequest;
|
return $serviceRequest;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ use Webmozart\Assert\Assert;
|
||||||
final class GetUserServicesQueryHandler
|
final class GetUserServicesQueryHandler
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ProductRepository $productRepository,
|
private readonly ProductRepository $productRepository,
|
||||||
private readonly UserRepository $userRepository,
|
private readonly UserRepository $userRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ final class UserAddressQueryHandler
|
||||||
private const WITH_LIMIT = 3;
|
private const WITH_LIMIT = 3;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly GeoProviderInterface $geoProvider
|
private readonly GeoProviderInterface $geoProvider,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ final class PayumManager
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Payum $payum,
|
private readonly Payum $payum,
|
||||||
#[Autowire('%env(string:PAYUM_GATEWAY)%')] private readonly string $payumGateway
|
#[Autowire('%env(string:PAYUM_GATEWAY)%')] private readonly string $payumGateway,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Entity\Category;
|
||||||
use App\Entity\Product;
|
use App\Entity\Product;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Enum\Product\ProductType;
|
use App\Enum\Product\ProductType;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
|
@ -16,7 +15,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||||
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
|
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* #@extends ServiceEntityRepository<Category>.
|
* @extends NestedTreeRepository<Category>.
|
||||||
*
|
*
|
||||||
* @method Category|null find($id, $lockMode = null, $lockVersion = null)
|
* @method Category|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
* @method Category|null findOneBy(array $criteria, array $orderBy = null)
|
* @method Category|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class GroupOfferRepository extends ServiceEntityRepository
|
||||||
/**
|
/**
|
||||||
* Return an object or throws an exception if not found.
|
* Return an object or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): GroupOffer
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): GroupOffer
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Group offer not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Group offer not found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ final class GroupRepository extends ServiceEntityRepository
|
||||||
/**
|
/**
|
||||||
* Return an object or throws an exception if not found.
|
* Return an object or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): Group
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): Group
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Group not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Group not found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ final class PaymentRepository extends ServiceEntityRepository
|
||||||
parent::__construct($registry, self::ENTITY_CLASS);
|
parent::__construct($registry, self::ENTITY_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): Payment
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): Payment
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Payment not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Payment not found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class PlatformOfferRepository extends ServiceEntityRepository
|
||||||
/**
|
/**
|
||||||
* Return an object or throws an exception if not found.
|
* Return an object or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): PlatformOffer
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): PlatformOffer
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Platform offer not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Platform offer not found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ final class ProductAvailabilityRepository extends ServiceEntityRepository
|
||||||
/**
|
/**
|
||||||
* Return product availability or throws an exception if not found.
|
* Return product availability or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): ProductAvailability
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): ProductAvailability
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('ProductAvailability not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('ProductAvailability not found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class ProductRepository extends ServiceEntityRepository
|
||||||
/**
|
/**
|
||||||
* Return an object or throws an exception if not found.
|
* Return an object or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): Product
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): Product
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Product not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Product not found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ final class ServiceRequestRepository extends ServiceEntityRepository
|
||||||
/**
|
/**
|
||||||
* Return an object or throws an exception if not found.
|
* Return an object or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): ServiceRequest
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): ServiceRequest
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Service request not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('Service request not found.');
|
||||||
}
|
}
|
||||||
|
|
@ -101,15 +101,15 @@ final class ServiceRequestRepository extends ServiceEntityRepository
|
||||||
*/
|
*/
|
||||||
public function getActionSoon(string $property, int $days = 1): Query
|
public function getActionSoon(string $property, int $days = 1): Query
|
||||||
{
|
{
|
||||||
$from = new \DateTimeImmutable(sprintf('+%d days midnight', $days));
|
$from = new \DateTimeImmutable(\sprintf('+%d days midnight', $days));
|
||||||
$to = $from->modify('+ 1 day'); // just add one day for the end limit
|
$to = $from->modify('+ 1 day'); // just add one day for the end limit
|
||||||
|
|
||||||
$qb = $this
|
$qb = $this
|
||||||
->createQueryBuilder('sr')
|
->createQueryBuilder('sr')
|
||||||
->innerJoin('sr.owner', 'o')
|
->innerJoin('sr.owner', 'o')
|
||||||
->innerJoin('sr.recipient', 'g')
|
->innerJoin('sr.recipient', 'g')
|
||||||
->andWhere(sprintf('sr.%s >= :from', $property))
|
->andWhere(\sprintf('sr.%s >= :from', $property))
|
||||||
->andWhere(sprintf('sr.%s < :to', $property))
|
->andWhere(\sprintf('sr.%s < :to', $property))
|
||||||
->setParameter('from', $from->format('Y-m-d'))
|
->setParameter('from', $from->format('Y-m-d'))
|
||||||
->setParameter('to', $to->format('Y-m-d'))
|
->setParameter('to', $to->format('Y-m-d'))
|
||||||
->andWhere('sr.status = :status')
|
->andWhere('sr.status = :status')
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class UserGroupRepository extends ServiceEntityRepository
|
||||||
*/
|
*/
|
||||||
public function getExpiring(int $days): Query
|
public function getExpiring(int $days): Query
|
||||||
{
|
{
|
||||||
$from = new \DateTimeImmutable(sprintf('+%d days midnight', $days));
|
$from = new \DateTimeImmutable(\sprintf('+%d days midnight', $days));
|
||||||
$to = $from->modify('+ 1 day'); // just add one day for the end limit
|
$to = $from->modify('+ 1 day'); // just add one day for the end limit
|
||||||
|
|
||||||
$qb = $this
|
$qb = $this
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
||||||
/**
|
/**
|
||||||
* Return object or throws an exception if not found.
|
* Return object or throws an exception if not found.
|
||||||
*/
|
*/
|
||||||
public function get(mixed $id, int|null $lockMode = null, int|null $lockVersion = null): User
|
public function get(mixed $id, ?int $lockMode = null, ?int $lockVersion = null): User
|
||||||
{
|
{
|
||||||
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('User not found.');
|
return $this->find($id, $lockMode, $lockVersion) ?? throw new \LogicException('User not found.');
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
||||||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||||
{
|
{
|
||||||
if (!$user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
throw new UnsupportedUserException(\sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->setPassword($newHashedPassword);
|
$user->setPassword($newHashedPassword);
|
||||||
|
|
|
||||||
|
|
@ -70,20 +70,20 @@ final class IndexProductsCommand extends Command
|
||||||
|
|
||||||
foreach ($query->toIterable() as $product) {
|
foreach ($query->toIterable() as $product) {
|
||||||
/** @var Product $product */
|
/** @var Product $product */
|
||||||
$io->comment(sprintf(' > adding product %s to batch', $product->getId()));
|
$io->comment(\sprintf(' > adding product %s to batch', $product->getId()));
|
||||||
$toIndex[] = $product;
|
$toIndex[] = $product;
|
||||||
if ((\count($toIndex) % $batchSize) === 0) {
|
if ((\count($toIndex) % $batchSize) === 0) {
|
||||||
$this->meilisearch->indexProducts($toIndex, $swapIndex);
|
$this->meilisearch->indexProducts($toIndex, $swapIndex);
|
||||||
$io->note(sprintf(' > indexing %d product(s) from batch', \count($toIndex)));
|
$io->note(\sprintf(' > indexing %d product(s) from batch', \count($toIndex)));
|
||||||
$toIndex = [];
|
$toIndex = [];
|
||||||
}
|
}
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->meilisearch->indexProducts($toIndex, $swapIndex);
|
$this->meilisearch->indexProducts($toIndex, $swapIndex);
|
||||||
$io->note(sprintf(' > indexing %d remaining product(s) from batch', \count($toIndex)));
|
$io->note(\sprintf(' > indexing %d remaining product(s) from batch', \count($toIndex)));
|
||||||
|
|
||||||
$io->note(sprintf(' -> %d product(s) indexed.', $count));
|
$io->note(\sprintf(' -> %d product(s) indexed.', $count));
|
||||||
$io->note(' -> DONE');
|
$io->note(' -> DONE');
|
||||||
$io->newLine();
|
$io->newLine();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ class Meilisearch
|
||||||
/**
|
/**
|
||||||
* Search with a main query and various filtery.
|
* Search with a main query and various filtery.
|
||||||
*/
|
*/
|
||||||
public function search(Search $searchDto, ProductType $productType = null): SearchResult
|
public function search(Search $searchDto, ?ProductType $productType = null): SearchResult
|
||||||
{
|
{
|
||||||
$searchParams = [];
|
$searchParams = [];
|
||||||
$searchParams = $this->withFilters($searchParams, $searchDto, $productType);
|
$searchParams = $this->withFilters($searchParams, $searchDto, $productType);
|
||||||
|
|
@ -240,13 +240,13 @@ class Meilisearch
|
||||||
|
|
||||||
// place filter
|
// place filter
|
||||||
if ($searchDto->place !== null) {
|
if ($searchDto->place !== null) {
|
||||||
$filters[] = sprintf('ownerId = %s', $searchDto->place->getId());
|
$filters[] = \sprintf('ownerId = %s', $searchDto->place->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// geo filter
|
// geo filter
|
||||||
if ($searchDto->hasProximity()) {
|
if ($searchDto->hasProximity()) {
|
||||||
Assert::isInstanceOf($searchDto->city, Address::class);
|
Assert::isInstanceOf($searchDto->city, Address::class);
|
||||||
$filters[] = sprintf('_geoRadius(%s, %s, %d)',
|
$filters[] = \sprintf('_geoRadius(%s, %s, %d)',
|
||||||
$searchDto->city->getLatitude(),
|
$searchDto->city->getLatitude(),
|
||||||
$searchDto->city->getLongitude(),
|
$searchDto->city->getLongitude(),
|
||||||
(int) $searchDto->distance * 1000 // the distance is in meters, not kilometers
|
(int) $searchDto->distance * 1000 // the distance is in meters, not kilometers
|
||||||
|
|
@ -271,7 +271,7 @@ class Meilisearch
|
||||||
// the proximity search has the priority to sort results
|
// the proximity search has the priority to sort results
|
||||||
if ($searchDto->hasProximity()) {
|
if ($searchDto->hasProximity()) {
|
||||||
Assert::isInstanceOf($searchDto->city, Address::class);
|
Assert::isInstanceOf($searchDto->city, Address::class);
|
||||||
$searchParams['sort'] = [sprintf('_geoPoint(%s, %s):asc',
|
$searchParams['sort'] = [\sprintf('_geoPoint(%s, %s):asc',
|
||||||
$searchDto->city->getLatitude(),
|
$searchDto->city->getLatitude(),
|
||||||
$searchDto->city->getLongitude()),
|
$searchDto->city->getLongitude()),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
final class AuthorizationChecker
|
final class AuthorizationChecker
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public readonly AuthorizationCheckerInterface $authorizationChecker
|
public readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ use function Symfony\Component\String\u;
|
||||||
class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
|
class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly UrlGeneratorInterface $urlGenerator
|
private readonly UrlGeneratorInterface $urlGenerator,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function start(Request $request, AuthenticationException $authException = null): RedirectResponse
|
public function start(Request $request, ?AuthenticationException $authException = null): RedirectResponse
|
||||||
{
|
{
|
||||||
/** @var string $route */
|
/** @var string $route */
|
||||||
$route = $request->attributes->get('_route');
|
$route = $request->attributes->get('_route');
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ final class ProductVoter extends Voter
|
||||||
self::DUPLICATE => $this->canDuplicate($subject, $user),
|
self::DUPLICATE => $this->canDuplicate($subject, $user),
|
||||||
self::BORROW => $this->canBorrow($subject, $user),
|
self::BORROW => $this->canBorrow($subject, $user),
|
||||||
self::DELETE => $this->canDelete($subject, $user),
|
self::DELETE => $this->canDelete($subject, $user),
|
||||||
default => throw new \LogicException('This code should not be reached!')
|
default => throw new \LogicException('This code should not be reached!'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ServiceRequestVoter extends Voter
|
||||||
|
|
||||||
return match ($attribute) {
|
return match ($attribute) {
|
||||||
self::VIEW => $this->canView($subject, $user),
|
self::VIEW => $this->canView($subject, $user),
|
||||||
default => throw new \LogicException('This code should not be reached!')
|
default => throw new \LogicException('This code should not be reached!'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ final class ProductDocumentNormalizer implements NormalizerInterface
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[Autowire(service: ObjectNormalizer::class)]
|
#[Autowire(service: ObjectNormalizer::class)]
|
||||||
private readonly NormalizerInterface $normalizer
|
private readonly NormalizerInterface $normalizer,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ final class ProductDocumentNormalizer implements NormalizerInterface
|
||||||
*
|
*
|
||||||
* @throws ExceptionInterface
|
* @throws ExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function normalize(mixed $object, string $format = null, array $context = []): array
|
public function normalize(mixed $object, ?string $format = null, array $context = []): array
|
||||||
{
|
{
|
||||||
/** @var array<string, mixed> $data */
|
/** @var array<string, mixed> $data */
|
||||||
$data = $this->normalizer->normalize($object, $format, $context);
|
$data = $this->normalizer->normalize($object, $format, $context);
|
||||||
|
|
@ -46,7 +46,7 @@ final class ProductDocumentNormalizer implements NormalizerInterface
|
||||||
/**
|
/**
|
||||||
* @param array<mixed> $context
|
* @param array<mixed> $context
|
||||||
*/
|
*/
|
||||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||||
{
|
{
|
||||||
return $data instanceof ProductDocument;
|
return $data instanceof ProductDocument;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ use App\Repository\GroupRepository;
|
||||||
final class GroupGetStatsProvider implements ProviderInterface
|
final class GroupGetStatsProvider implements ProviderInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
readonly private GroupRepository $groupRepository
|
readonly private GroupRepository $groupRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null // @phpstan-ignore-line
|
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||||
{
|
{
|
||||||
$groupStats = new GroupResource();
|
$groupStats = new GroupResource();
|
||||||
$groupStats->count = $this->groupRepository->count([]);
|
$groupStats->count = $this->groupRepository->count([]);
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,18 @@ class GroupsProvider implements ProviderInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
readonly private GroupRepository $groupRepository,
|
readonly private GroupRepository $groupRepository,
|
||||||
readonly private UserRepository $userRepository
|
readonly private UserRepository $userRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null // @phpstan-ignore-line
|
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||||
{
|
{
|
||||||
if (isset($context['filters']['user'])) {
|
if (isset($context['filters']['user'])) { // @phpstan-ignore-line
|
||||||
$user = $this->userRepository->find($context['filters']['user']);
|
$user = $this->userRepository->find($context['filters']['user']);
|
||||||
|
|
||||||
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true', $user);
|
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true', $user); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true');
|
return $this->groupRepository->getGroupsByEnabledServices($context['filters']['services_enabled'] === 'true'); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,19 @@ use ApiPlatform\Metadata\Operation;
|
||||||
use ApiPlatform\State\ProcessorInterface;
|
use ApiPlatform\State\ProcessorInterface;
|
||||||
use App\Entity\Group;
|
use App\Entity\Group;
|
||||||
use App\Repository\GroupRepository;
|
use App\Repository\GroupRepository;
|
||||||
use Webmozart\Assert\Assert;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements ProcessorInterface<Group,Group>
|
||||||
|
*/
|
||||||
class GroupChildServicesEnabledProcessor implements ProcessorInterface
|
class GroupChildServicesEnabledProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly GroupRepository $groupRepository
|
private readonly GroupRepository $groupRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<mixed> $uriVariables
|
|
||||||
* @param array<mixed> $context
|
|
||||||
*/
|
|
||||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Group
|
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Group
|
||||||
{
|
{
|
||||||
Assert::isInstanceOf($data, Group::class);
|
|
||||||
$this->groupRepository->disableServicesForChildGroup($data);
|
$this->groupRepository->disableServicesForChildGroup($data);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
|
||||||
|
|
@ -8,25 +8,21 @@ use ApiPlatform\Metadata\Operation;
|
||||||
use ApiPlatform\State\ProcessorInterface;
|
use ApiPlatform\State\ProcessorInterface;
|
||||||
use App\Entity\Product;
|
use App\Entity\Product;
|
||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use Webmozart\Assert\Assert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the status of a product from active to paused or the opposite.
|
* Change the status of a product from active to paused or the opposite.
|
||||||
|
*
|
||||||
|
* @implements ProcessorInterface<Product,Product>
|
||||||
*/
|
*/
|
||||||
final class ProductSwitchProcessor implements ProcessorInterface
|
final class ProductSwitchProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ProductRepository $productRepository
|
private readonly ProductRepository $productRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<mixed> $uriVariables
|
|
||||||
* @param array<mixed> $context
|
|
||||||
*/
|
|
||||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Product
|
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Product
|
||||||
{
|
{
|
||||||
Assert::isInstanceOf($data, Product::class);
|
|
||||||
$data->switchStatus();
|
$data->switchStatus();
|
||||||
$this->productRepository->save($data, true);
|
$this->productRepository->save($data, true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Workflow\Event\GuardEvent;
|
||||||
final class ServiceRequestAcceptTransitionSubscriber implements EventSubscriberInterface
|
final class ServiceRequestAcceptTransitionSubscriber implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public readonly Security $security
|
public readonly Security $security,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue