mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 11:03:50 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -25,20 +25,16 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
* AbstractTask.
|
||||
*
|
||||
* @ORM\MappedSuperclass
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "single_task": SingleTask::class
|
||||
* })
|
||||
*/
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['single_task' => SingleTask::class])]
|
||||
abstract class AbstractTask implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="\Chill\MainBundle\Entity\User"
|
||||
* )
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?User $assignee = null;
|
||||
|
||||
/**
|
||||
@@ -50,55 +46,47 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="closed", type="boolean", options={ "default": false })
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private bool $closed = false;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="\Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?AccompanyingPeriod $course = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="current_states", type="json", options={"jsonb"=true, "default"="[]"})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private array $currentStates = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="description", type="text")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private string $description = '';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="\Chill\PersonBundle\Entity\Person"
|
||||
* )
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="title", type="text")
|
||||
*
|
||||
* @Assert\NotBlank
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Assert\NotBlank]
|
||||
#[Serializer\Groups(['read'])]
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="type", type="string", length=255)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?string $type = null;
|
||||
|
||||
public function getAssignee(): ?User
|
||||
|
@@ -47,11 +47,9 @@ class SingleTask extends AbstractTask
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="end_date", type="date", nullable=true)
|
||||
*
|
||||
* @Assert\Date
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Assert\Date]
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?\DateTime $endDate = null;
|
||||
|
||||
/**
|
||||
@@ -60,9 +58,8 @@ class SingleTask extends AbstractTask
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
@@ -75,20 +72,11 @@ class SingleTask extends AbstractTask
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*
|
||||
* @Assert\Date
|
||||
*
|
||||
* @Assert\Expression(
|
||||
* "value === null or this.getEndDate() === null or value < this.getEndDate()",
|
||||
* message="The start date must be before the end date"
|
||||
* )
|
||||
* @Assert\Expression(
|
||||
* "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()",
|
||||
* message="The start date must be before warning date"
|
||||
* )
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
#[Assert\Date]
|
||||
#[Assert\Expression('value === null or this.getEndDate() === null or value < this.getEndDate()', message: 'The start date must be before the end date')]
|
||||
#[Assert\Expression('value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()', message: 'The start date must be before warning date')]
|
||||
private ?\DateTime $startDate = null;
|
||||
|
||||
/**
|
||||
@@ -104,14 +92,9 @@ class SingleTask extends AbstractTask
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*
|
||||
* @Assert\Expression(
|
||||
* "!(value != null and this.getEndDate() == null)",
|
||||
* message="An end date is required if a warning interval is set"
|
||||
* )
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
#[Assert\Expression('!(value != null and this.getEndDate() == null)', message: 'An end date is required if a warning interval is set')]
|
||||
private ?\DateInterval $warningInterval = null;
|
||||
|
||||
public function __construct()
|
||||
@@ -164,9 +147,8 @@ class SingleTask extends AbstractTask
|
||||
* Return null if warningDate or endDate is null
|
||||
*
|
||||
* @return \DateTimeImmutable
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
#[Serializer\Groups(['read'])]
|
||||
public function getWarningDate()
|
||||
{
|
||||
if (null === $this->getWarningInterval()) {
|
||||
|
Reference in New Issue
Block a user