Fix CS and add more comments within ticket bundle

This commit is contained in:
Julien Fastré 2025-06-02 15:51:11 +02:00
parent f1a5b5c49e
commit fc61dfdf3a
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
13 changed files with 50 additions and 9 deletions

View File

@ -31,7 +31,7 @@ final readonly class GeographicalUnitStatAggregator implements AggregatorInterfa
public function __construct( public function __construct(
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
private TranslatableStringHelperInterface $translatableStringHelper, private TranslatableStringHelperInterface $translatableStringHelper,
private RollingDateConverterInterface $rollingDateConverter private RollingDateConverterInterface $rollingDateConverter,
) {} ) {}
public function addRole(): ?string public function addRole(): ?string

View File

@ -68,6 +68,6 @@ interface PersonACLAwareRepositoryInterface
public function findByPhone( public function findByPhone(
PhoneNumber $phoneNumber, PhoneNumber $phoneNumber,
int $start = 0, int $start = 0,
int $limit = 20 int $limit = 20,
): array; ): array;
} }

View File

@ -24,6 +24,6 @@ final readonly class AddAddresseeCommand
{ {
public function __construct( public function __construct(
#[Groups(['read'])] #[Groups(['read'])]
public User|UserGroup $addressee public User|UserGroup $addressee,
) {} ) {}
} }

View File

@ -27,7 +27,7 @@ final readonly class SetAddresseesCommand
#[UserGroupDoNotExclude] #[UserGroupDoNotExclude]
#[GreaterThan(0)] #[GreaterThan(0)]
#[Groups(['read'])] #[Groups(['read'])]
public array $addressees public array $addressees,
) {} ) {}
public static function fromAddAddresseeCommand(AddAddresseeCommand $command, Ticket $ticket): self public static function fromAddAddresseeCommand(AddAddresseeCommand $command, Ticket $ticket): self

View File

@ -23,6 +23,6 @@ class SetPersonsCommand
*/ */
#[GreaterThan(0)] #[GreaterThan(0)]
#[Groups(['read'])] #[Groups(['read'])]
public array $persons public array $persons,
) {} ) {}
} }

View File

@ -19,12 +19,12 @@ use Twig\Environment;
class EditTicketController class EditTicketController
{ {
public function __construct( public function __construct(
private Environment $templating private Environment $templating,
) {} ) {}
#[Route('/{_locale}/ticket/ticket/{id}/edit', name: 'chill_ticket_ticket_edit')] #[Route('/{_locale}/ticket/ticket/{id}/edit', name: 'chill_ticket_ticket_edit')]
public function __invoke( public function __invoke(
Ticket $ticket Ticket $ticket,
): Response { ): Response {
return new Response( return new Response(
$this->templating->render( $this->templating->render(

View File

@ -20,6 +20,13 @@ use Chill\MainBundle\Entity\UserGroup;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* Represents the history entity for addressees in the context of a ticketing system.
*
* Tracks information about addressees for a specific ticket, including user or group associability,
* timestamps marking the start and end of the association, and the removal of assignments.
* Implements mechanisms for tracking entity creation and updates.
*/
#[ORM\Entity()] #[ORM\Entity()]
#[ORM\Table(name: 'addressee_history', schema: 'chill_ticket')] #[ORM\Table(name: 'addressee_history', schema: 'chill_ticket')]
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_addressee_history' => AddresseeHistory::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_addressee_history' => AddresseeHistory::class])]

View File

@ -19,6 +19,11 @@ use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\JoinColumn; use Doctrine\ORM\Mapping\JoinColumn;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* Represents a comment entity within the application.
*
* This entity is associated with a specific ticket and includes creation and update tracking.
*/
#[ORM\Entity()] #[ORM\Entity()]
#[ORM\Table(name: 'comment', schema: 'chill_ticket')] #[ORM\Table(name: 'comment', schema: 'chill_ticket')]
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_comment' => Comment::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_comment' => Comment::class])]

View File

@ -16,6 +16,11 @@ use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* History of input for a single ticket.
*
* An input is someone who triggered the opening of the ticket. Typically, it's the "caller" of a call.
*/
#[ORM\Entity()] #[ORM\Entity()]
#[ORM\Table(name: 'input_history', schema: 'chill_ticket')] #[ORM\Table(name: 'input_history', schema: 'chill_ticket')]
class InputHistory class InputHistory

View File

@ -16,6 +16,12 @@ use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* Represents the history of a motive associated with a ticket.
*
* This entity is used to track the changes in a ticket's motive over time.
* Implements the TrackCreationInterface for tracking entity lifecycle creation.
*/
#[ORM\Entity] #[ORM\Entity]
#[ORM\Table(name: 'motives_history', schema: 'chill_ticket')] #[ORM\Table(name: 'motives_history', schema: 'chill_ticket')]
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_motive_history' => MotiveHistory::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_motive_history' => MotiveHistory::class])]
@ -43,7 +49,7 @@ class MotiveHistory implements TrackCreationInterface
private Ticket $ticket, private Ticket $ticket,
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
private \DateTimeImmutable $startDate = new \DateTimeImmutable('now') private \DateTimeImmutable $startDate = new \DateTimeImmutable('now'),
) { ) {
$ticket->addMotiveHistory($this); $ticket->addMotiveHistory($this);
} }

View File

@ -18,6 +18,10 @@ use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* Represents a history entity associated with a person and a ticket.
* Tracks the start date, end date, and the user who removed the entry (if applicable).
*/
#[ORM\Entity] #[ORM\Entity]
#[ORM\Table(name: 'person_history', schema: 'chill_ticket')] #[ORM\Table(name: 'person_history', schema: 'chill_ticket')]
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_person_history' => PersonHistory::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['ticket_person_history' => PersonHistory::class])]

View File

@ -24,6 +24,20 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ReadableCollection; use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* This entity represents a `Ticket` in the application and provides functionality for managing its associated
* histories, comments, and current data such as addressees, inputs, and motives.
*
* Most of the associated data are handle through "histories", with a many-to-one relationship (a ticket may have multiple)
* history. The history contains the associated data (see below) and start dates and end dates.
*
* There are histories for:
*
* - association between the ticket and persons: @see{PersonHistory};
* - association between the ticket and motive: @see{MotiveHistory};
* - association between the ticket and addresses: @see{AddresseeHistory};
* - association between the ticket and input: @see{InputHistory};
*/
#[ORM\Entity] #[ORM\Entity]
#[ORM\Table(name: 'ticket', schema: 'chill_ticket')] #[ORM\Table(name: 'ticket', schema: 'chill_ticket')]
class Ticket implements TrackCreationInterface, TrackUpdateInterface class Ticket implements TrackCreationInterface, TrackUpdateInterface

View File

@ -42,7 +42,7 @@ final class SetAddresseesCommandDenormalizer implements DenormalizerInterface, D
$addresses[] = match ($address['type'] ?? '') { $addresses[] = match ($address['type'] ?? '') {
'user_group' => $this->denormalizer->denormalize($address, UserGroup::class, $format, $context), 'user_group' => $this->denormalizer->denormalize($address, UserGroup::class, $format, $context),
'user' => $this->denormalizer->denormalize($address, User::class, $format, $context), 'user' => $this->denormalizer->denormalize($address, User::class, $format, $context),
default => throw new UnexpectedValueException('the type is not set or not supported') default => throw new UnexpectedValueException('the type is not set or not supported'),
}; };
} }