Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 13:11:42 +02:00
parent a3f775a69b
commit 0ff4593863
118 changed files with 143 additions and 658 deletions

View File

@@ -62,7 +62,7 @@ final class EventController extends AbstractController
) {}
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'DELETE'])]
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|Response
{
$em = $this->managerRegistry->getManager();
$event = $em->getRepository(Event::class)->findOneBy([
@@ -110,7 +110,6 @@ final class EventController extends AbstractController
/**
* Displays a form to edit an existing Event entity.
*
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')]
public function editAction($event_id): Response
@@ -134,8 +133,6 @@ final class EventController extends AbstractController
/**
* List events subscriptions for a person.
*
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Doctrine\ORM\NonUniqueResultException
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])]
@@ -281,10 +278,9 @@ final class EventController extends AbstractController
*
* @ParamConverter("event", options={"id": "event_id"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*
* @throws \PhpOffice\PhpSpreadsheet\Exception
*
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')]
public function showAction(Event $event, Request $request)
@@ -318,7 +314,7 @@ final class EventController extends AbstractController
* Edits an existing Event entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/update', name: 'chill_event__event_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -289,7 +289,6 @@ final class ParticipationController extends AbstractController
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
*
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')]
public function editAction(int $participation_id): Response
@@ -321,7 +320,6 @@ final class ParticipationController extends AbstractController
* show a form to edit multiple participation for the same event.
*
* @param int $event_id
*
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')]
public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse

View File

@@ -23,7 +23,6 @@ use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -31,9 +30,6 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Event.
*
*
*
*/
#[ORM\Entity(repositoryClass: \Chill\EventBundle\Repository\EventRepository::class)]
#[ORM\HasLifecycleCallbacks]
@@ -44,22 +40,21 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
use TrackUpdateTrait;
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Center::class)] // A
#[ORM\ManyToOne(targetEntity: Center::class)] // A
private ?Center $center = null;
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)]
#[ORM\ManyToOne(targetEntity: Scope::class)]
private ?Scope $circle = null;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private ?\DateTime $date;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $moderator = null;
#[Assert\NotBlank]
@@ -69,25 +64,22 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @var Collection<Participation>
*/
#[ORM\OneToMany(targetEntity: \Chill\EventBundle\Entity\Participation::class, mappedBy: 'event')]
#[ORM\OneToMany(targetEntity: Participation::class, mappedBy: 'event')]
private Collection $participations;
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\EventType::class)]
#[ORM\ManyToOne(targetEntity: EventType::class)]
private ?EventType $type = null;
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment;
#[ORM\ManyToOne(targetEntity: Location::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Location $location = null;
/**
* @var Collection<StoredObject>
*
*
*/
#[ORM\ManyToMany(targetEntity: StoredObject::class, cascade: ['persist', 'refresh'])]
#[ORM\JoinTable('chill_event_event_documents')]

View File

@@ -17,9 +17,6 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Class EventType.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -29,7 +26,6 @@ class EventType
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false)]
private bool $active = true;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
@@ -44,13 +40,13 @@ class EventType
/**
* @var Collection<Role>
*/
#[ORM\OneToMany(targetEntity: \Chill\EventBundle\Entity\Role::class, mappedBy: 'type')]
#[ORM\OneToMany(targetEntity: Role::class, mappedBy: 'type')]
private Collection $roles;
/**
* @var Collection<Status>
*/
#[ORM\OneToMany(targetEntity: \Chill\EventBundle\Entity\Status::class, mappedBy: 'type')]
#[ORM\OneToMany(targetEntity: Status::class, mappedBy: 'type')]
private Collection $statuses;
/**

View File

@@ -26,9 +26,6 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Class Participation.
*
*
*
*/
#[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')]
#[ORM\Entity(repositoryClass: \Chill\EventBundle\Repository\ParticipationRepository::class)]
@@ -42,24 +39,23 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa
use TrackCreationTrait;
use TrackUpdateTrait;
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\Event::class, inversedBy: 'participations')]
#[ORM\ManyToOne(targetEntity: Event::class, inversedBy: 'participations')]
private ?Event $event = null;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
#[ORM\ManyToOne(targetEntity: Person::class)]
private ?Person $person = null;
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\Role::class)]
#[ORM\ManyToOne(targetEntity: Role::class)]
private ?Role $role = null;
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\Status::class)]
#[ORM\ManyToOne(targetEntity: Status::class)]
private ?Status $status = null;
public function getCenter()

View File

@@ -15,9 +15,6 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Class Role.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -27,7 +24,6 @@ class Role
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false)]
private bool $active = true;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
@@ -39,7 +35,7 @@ class Role
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name;
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\EventType::class, inversedBy: 'roles')]
#[ORM\ManyToOne(targetEntity: EventType::class, inversedBy: 'roles')]
private ?EventType $type = null;
/**

View File

@@ -15,9 +15,6 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Class Status.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -27,7 +24,6 @@ class Status
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false)]
private bool $active = true;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
@@ -39,7 +35,7 @@ class Status
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name;
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\EventType::class, inversedBy: 'statuses')]
#[ORM\ManyToOne(targetEntity: EventType::class, inversedBy: 'statuses')]
private ?EventType $type = null;
/**