mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-01-14 13:21:25 +00:00
adaptations after having merged ticket-app-master
This commit is contained in:
@@ -86,15 +86,17 @@ class InviteRepository implements ObjectRepository
|
||||
$qb->expr()->eq('i.status', ':status')
|
||||
)
|
||||
)
|
||||
->setParameters([
|
||||
'user' => $user,
|
||||
'status' => Invite::PENDING,
|
||||
]);
|
||||
->setParameters(
|
||||
new \Doctrine\Common\Collections\ArrayCollection([
|
||||
new \Doctrine\ORM\Query\Parameter('user', $user),
|
||||
new \Doctrine\ORM\Query\Parameter('status', Invite::PENDING),
|
||||
])
|
||||
);
|
||||
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function buildAcceptedInviteByUserAndDateRangeQuery(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to)
|
||||
private function buildAcceptedInviteByUserAndDateRangeQuery(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to): \Doctrine\ORM\QueryBuilder
|
||||
{
|
||||
$qb = $this->entityRepository->createQueryBuilder('i');
|
||||
|
||||
@@ -109,12 +111,16 @@ class InviteRepository implements ObjectRepository
|
||||
$qb->expr()->isNull('c.cancelReason')
|
||||
)
|
||||
)
|
||||
->setParameters([
|
||||
'user' => $user,
|
||||
'status' => Invite::ACCEPTED,
|
||||
'startDate' => $from,
|
||||
'endDate' => $to,
|
||||
]);
|
||||
->setParameters(
|
||||
new \Doctrine\Common\Collections\ArrayCollection(
|
||||
[
|
||||
new \Doctrine\ORM\Query\Parameter('user', $user),
|
||||
new \Doctrine\ORM\Query\Parameter('status', Invite::ACCEPTED),
|
||||
new \Doctrine\ORM\Query\Parameter('startDate', $from),
|
||||
new \Doctrine\ORM\Query\Parameter('endDate', $to),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
|
||||
@@ -189,10 +189,6 @@ class CRUDController extends AbstractController
|
||||
* build a default role name, using the crud resolver.
|
||||
*
|
||||
* This method should not be overriden. Override `getRoleFor` instead.
|
||||
*
|
||||
* @param string $action
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildDefaultRole(string $action): string
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ use Doctrine\Persistence\ObjectManager;
|
||||
*/
|
||||
class LoadLocationType extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
|
||||
final public const LOCATION_TYPE = 'location_type';
|
||||
|
||||
public function getOrder(): int
|
||||
|
||||
@@ -19,6 +19,9 @@ use Doctrine\Persistence\ObjectManager;
|
||||
class LoadUserJob extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
final public const USER_JOB = 'user_job';
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private array $socialWorker = ['en' => 'social worker', 'fr' => 'travailleur social'];
|
||||
|
||||
public function getOrder(): int
|
||||
|
||||
@@ -15,11 +15,10 @@ use DateTimeInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class DateNormalizer implements ContextAwareNormalizerInterface, NormalizerInterface, DenormalizerInterface
|
||||
class DateNormalizer implements NormalizerInterface, DenormalizerInterface
|
||||
{
|
||||
public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) {}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class DailyNotificationDigestCronJobTest extends TestCase
|
||||
// Assert dispatch count and message contents
|
||||
self::assertCount(2, $dispatched);
|
||||
$expectedLast = $firstNow->sub(new \DateInterval('P1D'));
|
||||
foreach ($dispatched as $i => $msg) {
|
||||
foreach ($dispatched as $msg) {
|
||||
self::assertInstanceOf(ScheduleDailyNotificationDigestMessage::class, $msg);
|
||||
self::assertTrue(in_array($msg->getUserId(), [10, 42], true));
|
||||
self::assertEquals($firstNow, $msg->getCurrentDateTime(), 'compare the current date');
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace Chill\PersonBundle\Controller;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactoryInterface;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\PersonBundle\PersonIdentifier\PersonIdentifierManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
final readonly class PersonIdentifierListApiController
|
||||
|
||||
@@ -29,7 +29,7 @@ final class PersonIdentifiersType extends AbstractType
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
foreach ($this->identifierManager->getWorkers() as $k => $worker) {
|
||||
foreach ($this->identifierManager->getWorkers() as $worker) {
|
||||
if (!$worker->getDefinition()->isEditableByUsers()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,13 @@ final readonly class PersonIdentifierWorkerNormalizer implements NormalizerInter
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return $data instanceof PersonIdentifierWorker;
|
||||
}
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return 'json' === $format ? [PersonIdentifierWorker::class => true] : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ use Chill\PersonBundle\PersonIdentifier\PersonIdentifierManagerInterface;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends \Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository<\Chill\PersonBundle\Entity\Identifier\PersonIdentifier>
|
||||
*/
|
||||
class PersonIdentifierRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry, private readonly PersonIdentifierManagerInterface $personIdentifierManager)
|
||||
|
||||
@@ -42,10 +42,10 @@ class PersonDocGenNormalizer implements
|
||||
|
||||
public function __construct(private readonly PersonRenderInterface $personRender, private readonly RelationshipRepository $relationshipRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SummaryBudgetInterface $summaryBudget) {}
|
||||
|
||||
public function normalize($person, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
|
||||
public function normalize($data, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
|
||||
{
|
||||
try {
|
||||
$context = $this->addCircularToContext($person, $context);
|
||||
$context = $this->addCircularToContext($data, $context);
|
||||
} catch (CircularReferenceException) {
|
||||
return [
|
||||
'isNull' => true,
|
||||
@@ -54,7 +54,7 @@ class PersonDocGenNormalizer implements
|
||||
];
|
||||
}
|
||||
|
||||
/** @var Person $person */
|
||||
/** @var Person $data */
|
||||
$dateContext = $context;
|
||||
$dateContext['docgen:expects'] = \DateTimeInterface::class;
|
||||
$addressContext = array_merge($context, ['docgen:expects' => Address::class]);
|
||||
@@ -69,53 +69,53 @@ class PersonDocGenNormalizer implements
|
||||
]);
|
||||
$genderContext = array_merge($context, ['docgen:expects' => Gender::class]);
|
||||
|
||||
if (null === $person) {
|
||||
if (null === $data) {
|
||||
return $this->normalizeNullValue($format, $context);
|
||||
}
|
||||
|
||||
if (!$person instanceof Person) {
|
||||
if (!$data instanceof Person) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
|
||||
$data = [
|
||||
'type' => 'person',
|
||||
'id' => $person->getId(),
|
||||
'id' => $data->getId(),
|
||||
'isNull' => false,
|
||||
'civility' => $this->normalizer->normalize($person->getCivility(), $format, array_merge($context, ['docgen:expects' => Civility::class])),
|
||||
'firstName' => $person->getFirstName(),
|
||||
'lastName' => $person->getLastName(),
|
||||
'civility' => $this->normalizer->normalize($data->getCivility(), $format, array_merge($context, ['docgen:expects' => Civility::class])),
|
||||
'firstName' => $data->getFirstName(),
|
||||
'lastName' => $data->getLastName(),
|
||||
'altNames' => \implode(
|
||||
', ',
|
||||
\array_map(
|
||||
static fn (PersonAltName $altName) => $altName->getLabel(),
|
||||
$person->getAltNames()->toArray()
|
||||
$data->getAltNames()->toArray()
|
||||
)
|
||||
),
|
||||
'text' => $this->personRender->renderString($person, []),
|
||||
'age' => (int) $person->getAge(),
|
||||
'birthdate' => $this->normalizer->normalize($person->getBirthdate(), $format, $dateContext),
|
||||
'deathdate' => $this->normalizer->normalize($person->getDeathdate(), $format, $dateContext),
|
||||
'gender' => null !== ($g = $person->getGender()) ? $this->translatableStringHelper->localize($g->getLabel()) : '',
|
||||
'genderEntity' => $this->normalizer->normalize($person->getGender(), $format, $genderContext),
|
||||
'maritalStatus' => null !== ($ms = $person->getMaritalStatus()) ? $this->translatableStringHelper->localize($ms->getName()) : '',
|
||||
'maritalStatusDate' => $this->normalizer->normalize($person->getMaritalStatusDate(), $format, $dateContext),
|
||||
'maritalStatusComment' => $this->normalizer->normalize($person->getMaritalStatusComment(), $format, $dateContext),
|
||||
'email' => $person->getEmail(),
|
||||
'firstPhoneNumber' => $this->normalizer->normalize($person->getPhonenumber() ?? $person->getMobilenumber(), $format, $phonenumberContext),
|
||||
'fixPhoneNumber' => $this->normalizer->normalize($person->getPhonenumber(), $format, $phonenumberContext),
|
||||
'mobilePhoneNumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $phonenumberContext),
|
||||
'nationality' => null !== ($c = $person->getNationality()) ? $this->translatableStringHelper->localize($c->getName()) : '',
|
||||
'placeOfBirth' => $person->getPlaceOfBirth(),
|
||||
'memo' => $person->getMemo(),
|
||||
'numberOfChildren' => (string) $person->getNumberOfChildren(),
|
||||
'address' => $this->normalizer->normalize($person->getCurrentPersonAddress(), $format, $addressContext),
|
||||
'resources' => $this->normalizer->normalize($person->getResources(), $format, $personResourceContext),
|
||||
'center' => $this->normalizer->normalize($person->getCenter(), $format, $centerContext),
|
||||
'text' => $this->personRender->renderString($data, []),
|
||||
'age' => (int) $data->getAge(),
|
||||
'birthdate' => $this->normalizer->normalize($data->getBirthdate(), $format, $dateContext),
|
||||
'deathdate' => $this->normalizer->normalize($data->getDeathdate(), $format, $dateContext),
|
||||
'gender' => null !== ($g = $data->getGender()) ? $this->translatableStringHelper->localize($g->getLabel()) : '',
|
||||
'genderEntity' => $this->normalizer->normalize($data->getGender(), $format, $genderContext),
|
||||
'maritalStatus' => null !== ($ms = $data->getMaritalStatus()) ? $this->translatableStringHelper->localize($ms->getName()) : '',
|
||||
'maritalStatusDate' => $this->normalizer->normalize($data->getMaritalStatusDate(), $format, $dateContext),
|
||||
'maritalStatusComment' => $this->normalizer->normalize($data->getMaritalStatusComment(), $format, $dateContext),
|
||||
'email' => $data->getEmail(),
|
||||
'firstPhoneNumber' => $this->normalizer->normalize($data->getPhonenumber() ?? $data->getMobilenumber(), $format, $phonenumberContext),
|
||||
'fixPhoneNumber' => $this->normalizer->normalize($data->getPhonenumber(), $format, $phonenumberContext),
|
||||
'mobilePhoneNumber' => $this->normalizer->normalize($data->getMobilenumber(), $format, $phonenumberContext),
|
||||
'nationality' => null !== ($c = $data->getNationality()) ? $this->translatableStringHelper->localize($c->getName()) : '',
|
||||
'placeOfBirth' => $data->getPlaceOfBirth(),
|
||||
'memo' => $data->getMemo(),
|
||||
'numberOfChildren' => (string) $data->getNumberOfChildren(),
|
||||
'address' => $this->normalizer->normalize($data->getCurrentPersonAddress(), $format, $addressContext),
|
||||
'resources' => $this->normalizer->normalize($data->getResources(), $format, $personResourceContext),
|
||||
'center' => $this->normalizer->normalize($data->getCenter(), $format, $centerContext),
|
||||
];
|
||||
|
||||
if ($context['docgen:person:with-household'] ?? false) {
|
||||
$data['household'] = $this->normalizer->normalize(
|
||||
$person->getCurrentHousehold(),
|
||||
$data->getCurrentHousehold(),
|
||||
$format,
|
||||
array_merge($context, [
|
||||
'docgen:expects' => Household::class,
|
||||
@@ -128,22 +128,22 @@ class PersonDocGenNormalizer implements
|
||||
|
||||
if ($context['docgen:person:with-relations'] ?? false) {
|
||||
$data['relations'] = $this->normalizer->normalize(
|
||||
new ArrayCollection($this->relationshipRepository->findByPerson($person)),
|
||||
new ArrayCollection($this->relationshipRepository->findByPerson($data)),
|
||||
$format,
|
||||
array_merge($context, [
|
||||
'docgen:person:with-household' => false,
|
||||
'docgen:person:with-relation' => false,
|
||||
'docgen:relationship:counterpart' => $person,
|
||||
'docgen:relationship:counterpart' => $data,
|
||||
'docgen:person:with-budget' => false,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
if ($context['docgen:person:with-budget'] ?? false) {
|
||||
$data['budget']['person'] = $this->summaryBudget->getSummaryForPerson($person);
|
||||
$data['budget']['person'] = $this->summaryBudget->getSummaryForPerson($data);
|
||||
|
||||
if ($context['docgen:person:with-household'] ?? false) {
|
||||
$data['budget']['household'] = $this->summaryBudget->getSummaryForHousehold($person->getCurrentHousehold());
|
||||
$data['budget']['household'] = $this->summaryBudget->getSummaryForHousehold($data->getCurrentHousehold());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,8 +148,17 @@ final class PersonJsonDenormalizer implements DenormalizerInterface, Denormalize
|
||||
return $person;
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, $type, $format = null): bool
|
||||
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
|
||||
{
|
||||
return Person::class === $type && 'person' === ($data['type'] ?? null) && !isset($data['id']);
|
||||
}
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
if ('json' === $format) {
|
||||
return [Person::class => false];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonAltName;
|
||||
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
@@ -38,50 +39,54 @@ class PersonJsonNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
private readonly \Chill\PersonBundle\PersonIdentifier\Rendering\PersonIdRenderingInterface $personIdRendering,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param Person $person
|
||||
* @param string|null $format
|
||||
*/
|
||||
public function normalize($person, $format = null, array $context = [])
|
||||
public function normalize($data, $format = null, array $context = []): array
|
||||
{
|
||||
if (!$data instanceof Person) {
|
||||
throw new UnexpectedValueException(sprintf('Expected %s, got %s', Person::class, is_object($data) ? get_class($data) : gettype($data)));
|
||||
}
|
||||
|
||||
$groups = $context[AbstractNormalizer::GROUPS] ?? [];
|
||||
|
||||
if (\is_string($groups)) {
|
||||
$groups = [$groups];
|
||||
}
|
||||
$household = $person->getCurrentHousehold();
|
||||
$currentResidentialAddresses = $this->residentialAddressRepository->findCurrentResidentialAddressByPerson($person);
|
||||
$household = $data->getCurrentHousehold();
|
||||
$currentResidentialAddresses = $this->residentialAddressRepository->findCurrentResidentialAddressByPerson($data);
|
||||
|
||||
$data = [
|
||||
$normalizedData = [
|
||||
'type' => 'person',
|
||||
'id' => $person->getId(),
|
||||
'text' => $this->render->renderString($person, ['addAge' => false]),
|
||||
'textAge' => $this->render->renderString($person, ['addAge' => true]),
|
||||
'firstName' => $person->getFirstName(),
|
||||
'lastName' => $person->getLastName(),
|
||||
'current_household_address' => $this->normalizer->normalize($person->getCurrentHouseholdAddress(), $format, $context),
|
||||
'birthdate' => $this->normalizer->normalize($person->getBirthdate(), $format, $context),
|
||||
'deathdate' => $this->normalizer->normalize($person->getDeathdate(), $format, $context),
|
||||
'age' => $this->normalizer->normalize($person->getAge(), $format, $context),
|
||||
'phonenumber' => $this->normalizer->normalize($person->getPhonenumber(), $format, $context),
|
||||
'mobilenumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $context),
|
||||
'email' => $person->getEmail(),
|
||||
'gender' => $this->normalizer->normalize($person->getGender(), $format, $context),
|
||||
'civility' => $this->normalizer->normalize($person->getCivility(), $format, $context),
|
||||
'personId' => $this->personIdRendering->renderPersonId($person),
|
||||
'identifiers' => $this->normalizer->normalize($person->getIdentifiers(), $format, $context),
|
||||
'id' => $data->getId(),
|
||||
'text' => $this->render->renderString($data, ['addAge' => false]),
|
||||
'textAge' => $this->render->renderString($data, ['addAge' => true]),
|
||||
'firstName' => $data->getFirstName(),
|
||||
'lastName' => $data->getLastName(),
|
||||
'current_household_address' => $this->normalizer->normalize($data->getCurrentHouseholdAddress(), $format, $context),
|
||||
'birthdate' => $this->normalizer->normalize($data->getBirthdate(), $format, $context),
|
||||
'deathdate' => $this->normalizer->normalize($data->getDeathdate(), $format, $context),
|
||||
'age' => $this->normalizer->normalize($data->getAge(), $format, $context),
|
||||
'phonenumber' => $this->normalizer->normalize($data->getPhonenumber(), $format, $context),
|
||||
'mobilenumber' => $this->normalizer->normalize($data->getMobilenumber(), $format, $context),
|
||||
'email' => $data->getEmail(),
|
||||
'gender' => $this->normalizer->normalize($data->getGender(), $format, $context),
|
||||
'civility' => $this->normalizer->normalize($data->getCivility(), $format, $context),
|
||||
'personId' => $this->personIdRendering->renderPersonId($data),
|
||||
'identifiers' => $this->normalizer->normalize($data->getIdentifiers(), $format, $context),
|
||||
];
|
||||
|
||||
if (\in_array('minimal', $groups, true) && 1 === \count($groups)) {
|
||||
return $data;
|
||||
return $normalizedData;
|
||||
}
|
||||
|
||||
return [...$data, 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($person), $format, $context), 'altNames' => $this->normalizeAltNames($person->getAltNames()), 'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null, 'current_residential_addresses' => $currentResidentialAddresses ?
|
||||
$this->normalizer->normalize($currentResidentialAddresses, $format, $context) :
|
||||
null];
|
||||
return [
|
||||
...$normalizedData,
|
||||
'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($data), $format, $context),
|
||||
'altNames' => $this->normalizeAltNames($data->getAltNames()),
|
||||
'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null,
|
||||
'current_residential_addresses' => $currentResidentialAddresses ? $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : null,
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, $format = null): bool
|
||||
public function supportsNormalization($data, $format = null, array $context = []): bool
|
||||
{
|
||||
return $data instanceof Person && 'json' === $format;
|
||||
}
|
||||
@@ -91,7 +96,7 @@ class PersonJsonNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
*
|
||||
* @return array<array-key, array<string, string>>
|
||||
*/
|
||||
protected function normalizeAltNames(Collection $altNames): array
|
||||
private function normalizeAltNames(Collection $altNames): array
|
||||
{
|
||||
return $altNames
|
||||
->map(
|
||||
@@ -105,6 +110,6 @@ class PersonJsonNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return 'json' === $format ? [Person::class => true] : [];
|
||||
return 'json' === $format ? [Person::class => false] : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,13 @@ readonly class PersonJsonReadDenormalizer implements DenormalizerInterface
|
||||
throw new LogicException();
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null)
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return is_array($data) && Person::class === $type && 'person' === ($data['type'] ?? null) && isset($data['id']);
|
||||
}
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return 'json' === $format ? [Person::class => true] : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ use Chill\TicketBundle\Action\Ticket\SetAddresseesCommand;
|
||||
use Chill\TicketBundle\Entity\AddresseeHistory;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final readonly class SetAddresseesCommandHandler
|
||||
{
|
||||
|
||||
@@ -18,8 +18,8 @@ use Chill\TicketBundle\Entity\Ticket;
|
||||
use Chill\TicketBundle\Event\PersonsUpdateEvent;
|
||||
use Chill\TicketBundle\Event\TicketUpdateEvent;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
final readonly class SetPersonsCommandHandler
|
||||
|
||||
@@ -14,32 +14,22 @@ namespace Chill\TicketBundle\Command;
|
||||
use Chill\TicketBundle\Service\Import\ImportMotivesFromDirectory;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[AsCommand(name: 'chill:ticket:import_ticket_motive_configuration', description: 'Import ticket motives from a directory configuration.')]
|
||||
class ImportTicketMotiveConfigurationCommand extends Command
|
||||
final readonly class ImportTicketMotiveConfigurationCommand
|
||||
{
|
||||
protected static $defaultName = 'chill:ticket:import_ticket_motive_configuration';
|
||||
public function __construct(private ImportMotivesFromDirectory $importMotivesFromDirectory) {}
|
||||
|
||||
public function __construct(private readonly ImportMotivesFromDirectory $importMotivesFromDirectory)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Import ticket motives from a directory containing motives.yaml and referenced files')
|
||||
->addArgument('directory', InputArgument::REQUIRED, 'The directory path containing motives.yaml')
|
||||
->addArgument('lang', InputArgument::REQUIRED, 'The language key to use for matching labels (e.g., fr)');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$directory = (string) $input->getArgument('directory');
|
||||
$lang = (string) $input->getArgument('lang');
|
||||
public function __invoke(
|
||||
#[\Symfony\Component\Console\Attribute\Argument(description: 'The directory path containing motives.yaml', name: 'directory')]
|
||||
string $directory,
|
||||
#[\Symfony\Component\Console\Attribute\Argument(description: 'The language key to use for matching labels (e.g., fr)', name: 'lang')]
|
||||
string $lang,
|
||||
OutputInterface $output,
|
||||
): int {
|
||||
$directory = (string) $directory;
|
||||
$lang = (string) $lang;
|
||||
|
||||
$this->importMotivesFromDirectory->import($directory, $lang);
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@ use Chill\TicketBundle\Action\Ticket\Handler\AddCommentCommandHandler;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Chill\TicketBundle\Security\Voter\CommentVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
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\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\TicketBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
/**
|
||||
* Class AdminController
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace Chill\TicketBundle\Controller;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,11 +16,11 @@ use Chill\TicketBundle\Action\Ticket\Handler\ChangeEmergencyStateCommandHandler;
|
||||
use Chill\TicketBundle\Entity\EmergencyStatusEnum;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,11 +16,11 @@ use Chill\TicketBundle\Action\Ticket\Handler\ChangeStateCommandHandler;
|
||||
use Chill\TicketBundle\Entity\StateEnum;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,13 +17,13 @@ use Chill\TicketBundle\Action\Ticket\CreateTicketCommand;
|
||||
use Chill\TicketBundle\Action\Ticket\Handler\CreateTicketCommandHandler;
|
||||
use Chill\TicketBundle\Repository\TicketRepositoryInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
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\Routing\Attribute\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final readonly class CreateTicketController
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Chill\TicketBundle\Controller;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Twig\Environment;
|
||||
|
||||
class EditTicketController
|
||||
|
||||
@@ -15,12 +15,12 @@ use Chill\TicketBundle\Action\Ticket\Handler\ReplaceMotiveCommandHandler;
|
||||
use Chill\TicketBundle\Action\Ticket\ReplaceMotiveCommand;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
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\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
@@ -16,12 +16,12 @@ use Chill\TicketBundle\Action\Ticket\Handler\SetAddresseesCommandHandler;
|
||||
use Chill\TicketBundle\Action\Ticket\SetAddresseesCommand;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
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\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
@@ -15,13 +15,13 @@ use Chill\TicketBundle\Action\Ticket\SetCallerCommand;
|
||||
use Chill\TicketBundle\Action\Ticket\Handler\SetCallerCommandHandler;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,12 +15,12 @@ use Chill\TicketBundle\Action\Ticket\Handler\SetPersonsCommandHandler;
|
||||
use Chill\TicketBundle\Action\Ticket\SetPersonsCommand;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
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\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace Chill\TicketBundle\Controller;
|
||||
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Chill\TicketBundle\Service\Ticket\SuggestPersonForTicketInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
final readonly class SuggestPersonForTicketApiController
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Chill\TicketBundle\Controller;
|
||||
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class TicketControllerApi
|
||||
|
||||
@@ -22,14 +22,14 @@ use Chill\TicketBundle\Entity\EmergencyStatusEnum;
|
||||
use Chill\TicketBundle\Entity\StateEnum;
|
||||
use Chill\TicketBundle\Repository\MotiveRepository;
|
||||
use Chill\TicketBundle\Repository\TicketACLAwareRepositoryInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
final readonly class TicketListApiController
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace Chill\TicketBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
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\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Twig\Environment;
|
||||
|
||||
final readonly class TicketListController
|
||||
|
||||
@@ -16,12 +16,12 @@ use Chill\TicketBundle\Action\Comment\UpdateCommentContentCommand;
|
||||
use Chill\TicketBundle\Entity\Comment;
|
||||
use Chill\TicketBundle\Security\Voter\CommentVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
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\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ use Chill\TicketBundle\Action\Comment\UpdateCommentDeletedStatusCommand;
|
||||
use Chill\TicketBundle\Entity\Comment;
|
||||
use Chill\TicketBundle\Security\Voter\CommentVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
final readonly class UpdateCommentDeletedStatusController
|
||||
|
||||
@@ -19,6 +19,8 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @template-extends ServiceEntityRepository<Motive>
|
||||
*
|
||||
* @extends \Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository<\Chill\TicketBundle\Entity\Motive>
|
||||
*/
|
||||
class MotiveRepository extends ServiceEntityRepository implements AssociatedEntityToStoredObjectInterface
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ final class CommentVoter extends Voter
|
||||
return $subject instanceof Comment && in_array($attribute, self::ALL, true);
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
|
||||
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?\Symfony\Component\Security\Core\Authorization\Voter\Vote $vote = null): bool
|
||||
{
|
||||
/* @var Comment $subject */
|
||||
return match ($attribute) {
|
||||
|
||||
@@ -30,7 +30,7 @@ final class TicketVoter extends Voter
|
||||
return $subject instanceof Ticket && in_array($attribute, self::ALL, true);
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
|
||||
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?\Symfony\Component\Security\Core\Authorization\Voter\Vote $vote = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ final class SetAddresseesCommandDenormalizer implements DenormalizerInterface, D
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = [])
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): ?SetAddresseesCommand
|
||||
{
|
||||
if (null === $data) {
|
||||
return null;
|
||||
@@ -49,8 +49,13 @@ final class SetAddresseesCommandDenormalizer implements DenormalizerInterface, D
|
||||
return new SetAddresseesCommand($addresses);
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null)
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return SetAddresseesCommand::class === $type && 'json' === $format;
|
||||
}
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return 'json' === $format ? [SetAddresseesCommand::class => false] : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class SetPersonsCommandDenormalizer implements DenormalizerInterface, Denormaliz
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = [])
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): ?SetPersonsCommand
|
||||
{
|
||||
if (null === $data) {
|
||||
return null;
|
||||
@@ -44,8 +44,13 @@ class SetPersonsCommandDenormalizer implements DenormalizerInterface, Denormaliz
|
||||
return new SetPersonsCommand($persons);
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null)
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return SetPersonsCommand::class === $type;
|
||||
}
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return 'json' === $format ? [SetPersonsCommand::class => false] : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ use Chill\TicketBundle\Entity\PersonHistory;
|
||||
use Chill\TicketBundle\Entity\StateHistory;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Chill\TicketBundle\Security\Voter\CommentVoter;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
@@ -35,7 +35,7 @@ final class TicketNormalizer implements NormalizerInterface, NormalizerAwareInte
|
||||
|
||||
public function __construct(private Security $security) {}
|
||||
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
public function normalize($object, ?string $format = null, array $context = []): array
|
||||
{
|
||||
if (!$object instanceof Ticket) {
|
||||
throw new UnexpectedValueException();
|
||||
@@ -74,7 +74,7 @@ final class TicketNormalizer implements NormalizerInterface, NormalizerAwareInte
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null)
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return 'json' === $format && $data instanceof Ticket;
|
||||
}
|
||||
@@ -280,4 +280,9 @@ final class TicketNormalizer implements NormalizerInterface, NormalizerAwareInte
|
||||
|
||||
return $steps;
|
||||
}
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return 'json' === $format ? [Ticket::class => false] : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
chill_ticket_controller:
|
||||
resource: '@ChillTicketBundle/Controller/'
|
||||
type: annotation
|
||||
type: attribute
|
||||
|
||||
@@ -61,7 +61,7 @@ YAML;
|
||||
$emProphecy->persist(Argument::type(StoredObject::class))->shouldBeCalled();
|
||||
$capturedMotive = null;
|
||||
$emProphecy->persist(Argument::type(Motive::class))
|
||||
->will(function ($args) use (&$capturedMotive) {
|
||||
->will(function ($args) use (&$capturedMotive): void {
|
||||
$capturedMotive = $args[0];
|
||||
})
|
||||
->shouldBeCalled();
|
||||
@@ -121,7 +121,7 @@ YAML;
|
||||
$persistedMotives = [];
|
||||
$emProphecy = $this->prophesize(EntityManagerInterface::class);
|
||||
$emProphecy->persist(Argument::type(Motive::class))
|
||||
->will(function ($args) use (&$persistedMotives) {
|
||||
->will(function ($args) use (&$persistedMotives): void {
|
||||
$persistedMotives[] = $args[0];
|
||||
})
|
||||
->shouldBeCalled();
|
||||
@@ -195,7 +195,7 @@ YAML;
|
||||
$persistedMotives = [];
|
||||
$emProphecy = $this->prophesize(EntityManagerInterface::class);
|
||||
$emProphecy->persist(Argument::type(Motive::class))
|
||||
->will(function ($args) use (&$persistedMotives) {
|
||||
->will(function ($args) use (&$persistedMotives): void {
|
||||
$persistedMotives[] = $args[0];
|
||||
})
|
||||
->shouldBeCalled();
|
||||
|
||||
Reference in New Issue
Block a user