mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
Apply rector rules: add annotation for doctrine mapping
This commit is contained in:
@@ -36,7 +36,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
|
||||
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])]
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'chill_calendar.calendar')]
|
||||
@@ -83,17 +82,17 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
public ?User $previousMainUser = null;
|
||||
|
||||
#[Serializer\Groups(['calendar:read', 'read'])]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'calendars')]
|
||||
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class, inversedBy: 'calendars')]
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\Activity::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Activity::class)]
|
||||
private ?Activity $activity = null;
|
||||
|
||||
#[Serializer\Groups(['calendar:read', 'read'])]
|
||||
#[ORM\OneToOne(targetEntity: \CalendarRange::class, inversedBy: 'calendar')]
|
||||
#[ORM\OneToOne(targetEntity: CalendarRange::class, inversedBy: 'calendar')]
|
||||
private ?CalendarRange $calendarRange = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: \CancelReason::class)]
|
||||
#[ORM\ManyToOne(targetEntity: CancelReason::class)]
|
||||
private ?CancelReason $cancelReason = null;
|
||||
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])]
|
||||
@@ -114,7 +113,6 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
@@ -122,8 +120,6 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var Collection&Selectable<int, Invite>
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
@@ -133,29 +129,25 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
#[Assert\NotNull(message: 'calendar.A location is required')]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Location::class)]
|
||||
private ?Location $location = null;
|
||||
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
#[Assert\NotNull(message: 'calendar.A main user is mandatory')]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
|
||||
private ?User $mainUser = null;
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Person::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @var Collection<Person>
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
#[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')]
|
||||
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class, inversedBy: 'calendars')]
|
||||
#[ORM\ManyToMany(targetEntity: Person::class, inversedBy: 'calendars')]
|
||||
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_persons')]
|
||||
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
|
||||
private Collection $persons;
|
||||
@@ -166,11 +158,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
|
||||
/**
|
||||
* @var Collection<ThirdParty>
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
#[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)]
|
||||
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]
|
||||
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_thirdparties')]
|
||||
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
|
||||
private Collection $professionals;
|
||||
|
@@ -20,7 +20,6 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'chill_calendar.calendar_doc')]
|
||||
class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
|
||||
@@ -29,7 +28,6 @@ class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
use TrackUpdateTrait;
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'documents')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private Calendar $calendar;
|
||||
@@ -37,7 +35,6 @@ class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])]
|
||||
private int $datetimeVersion = 0;
|
||||
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
@@ -46,11 +43,12 @@ class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])]
|
||||
private bool $trackDateTimeVersion = false;
|
||||
|
||||
public function __construct(Calendar $calendar,
|
||||
public function __construct(
|
||||
Calendar $calendar,
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?StoredObject $storedObject)
|
||||
{
|
||||
private ?StoredObject $storedObject
|
||||
) {
|
||||
$this->setCalendar($calendar);
|
||||
$this->datetimeVersion = $calendar->getDateTimeVersion();
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'chill_calendar.calendar_range')]
|
||||
#[ORM\UniqueConstraint(name: 'idx_calendar_range_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
|
||||
@@ -41,14 +40,12 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
|
||||
#[Groups(['read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
private ?int $id = null;
|
||||
|
||||
|
||||
#[Groups(['read', 'write', 'calendar:read'])]
|
||||
#[Assert\NotNull]
|
||||
#[ORM\ManyToOne(targetEntity: Location::class)]
|
||||
@@ -62,7 +59,7 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
#[Groups(['read', 'write', 'calendar:read'])]
|
||||
#[Assert\NotNull]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
private ?User $user = null;
|
||||
|
||||
public function getCalendar(): ?Calendar
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\CalendarBundle\Entity;
|
||||
use Chill\CalendarBundle\Repository\CancelReasonRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
#[ORM\Entity(repositoryClass: CancelReasonRepository::class)]
|
||||
#[ORM\Table(name: 'chill_calendar.cancel_reason')]
|
||||
class CancelReason
|
||||
@@ -31,7 +30,6 @@ class CancelReason
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
|
||||
private ?string $canceledBy = null;
|
||||
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
|
@@ -24,8 +24,6 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
*
|
||||
* The event/calendar in the user may have a different id than the mainUser. We add then fields to store the
|
||||
* remote id of this event in the remote calendar.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'chill_calendar.invite')]
|
||||
@@ -59,7 +57,6 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
|
||||
#[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'invites')]
|
||||
private ?Calendar $calendar = null;
|
||||
|
||||
|
||||
#[Serializer\Groups(groups: ['calendar:read', 'read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
@@ -70,9 +67,8 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => 'pending'])]
|
||||
private string $status = self::PENDING;
|
||||
|
||||
|
||||
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $user = null;
|
||||
|
||||
|
Reference in New Issue
Block a user