mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -62,12 +62,7 @@ final class SingleTaskController extends AbstractController
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/{id}/delete",
|
||||
* name="chill_task_single_task_delete"
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/{id}/delete', name: 'chill_task_single_task_delete')]
|
||||
public function deleteAction(Request $request, mixed $id)
|
||||
{
|
||||
$course = null;
|
||||
@@ -163,12 +158,7 @@ final class SingleTaskController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/{id}/edit",
|
||||
* name="chill_task_single_task_edit"
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/{id}/edit', name: 'chill_task_single_task_edit')]
|
||||
public function editAction(
|
||||
SingleTask $task,
|
||||
Request $request
|
||||
@@ -258,12 +248,8 @@ final class SingleTaskController extends AbstractController
|
||||
* - person_id
|
||||
* - hide_form (hide the form to filter the tasks)
|
||||
* - status: date state, amongst SingleTaskRepository::DATE_STATUSES, or 'closed'.
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/list",
|
||||
* name="chill_task_singletask_list"
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/list', name: 'chill_task_singletask_list')]
|
||||
public function listAction(
|
||||
Request $request
|
||||
) {
|
||||
@@ -316,11 +302,7 @@ final class SingleTaskController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/by-course/{id}",
|
||||
* name="chill_task_singletask_by-course_list")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/by-course/{id}', name: 'chill_task_singletask_by-course_list')]
|
||||
public function listCourseTasks(
|
||||
AccompanyingPeriod $course,
|
||||
FormFactoryInterface $formFactory,
|
||||
@@ -367,11 +349,7 @@ final class SingleTaskController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/by-person/{id}",
|
||||
* name="chill_task_singletask_by-person_list")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/by-person/{id}', name: 'chill_task_singletask_by-person_list')]
|
||||
public function listPersonTasks(
|
||||
Person $person
|
||||
): Response {
|
||||
@@ -418,17 +396,9 @@ final class SingleTaskController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/list/my",
|
||||
* name="chill_task_singletask_my_tasks",
|
||||
* defaults={"_format": "html"}
|
||||
* )
|
||||
* @Route(
|
||||
* "/api/1.0/task/single-task/list/my",
|
||||
* defaults={"_format": "json"}
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/list/my', name: 'chill_task_singletask_my_tasks', defaults: ['_format' => 'html'])]
|
||||
#[Route(path: '/api/1.0/task/single-task/list/my', defaults: ['_format' => 'json'])]
|
||||
public function myTasksAction(string $_format, Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
@@ -484,12 +454,7 @@ final class SingleTaskController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/new",
|
||||
* name="chill_task_single_task_new"
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/new', name: 'chill_task_single_task_new')]
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$user = $this->security->getUser();
|
||||
@@ -600,12 +565,7 @@ final class SingleTaskController extends AbstractController
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/{id}/show",
|
||||
* name="chill_task_single_task_show"
|
||||
* )
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/single-task/{id}/show', name: 'chill_task_single_task_show')]
|
||||
public function showAction(SingleTask $task, Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $task);
|
||||
|
@@ -36,17 +36,13 @@ class TaskController extends AbstractController
|
||||
/**
|
||||
* Apply a transition to a task.
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/task/transition/{kind}/{taskId}/{transition}",
|
||||
* name="chill_task_task_transition"
|
||||
* )
|
||||
*
|
||||
* @param string $kind
|
||||
* @param int $taskId
|
||||
* @param string $transition
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/{_locale}/task/transition/{kind}/{taskId}/{transition}', name: 'chill_task_task_transition')]
|
||||
public function applyTransitionAction(
|
||||
$kind,
|
||||
$taskId,
|
||||
|
@@ -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