diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php index 4e658575b..2325f4221 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php @@ -12,8 +12,9 @@ declare(strict_types=1); namespace Chill\PersonBundle\Entity\Relationships; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; +use Chill\MainBundle\Doctrine\Model\TrackCreationTrait; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; -use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Validator\Constraints\Relationship\RelationshipNoDuplicate; use Doctrine\ORM\Mapping as ORM; @@ -30,12 +31,8 @@ use Symfony\Component\Validator\Constraints as Assert; #[RelationshipNoDuplicate] class Relationship implements TrackCreationInterface, TrackUpdateInterface { - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] - private ?\DateTimeImmutable $createdAt = null; - - #[ORM\ManyToOne(targetEntity: User::class)] - #[ORM\JoinColumn(nullable: false)] - private ?User $createdBy = null; + use TrackCreationTrait; + use TrackUpdateTrait; #[Assert\NotNull] #[Serializer\Groups(['read', 'write'])] @@ -66,22 +63,6 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface #[ORM\JoinColumn(nullable: false)] private ?Person $toPerson = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] - private ?\DateTimeImmutable $updatedAt = null; - - #[ORM\ManyToOne(targetEntity: User::class)] - private ?User $updatedBy = null; - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->createdAt; - } - - public function getCreatedBy(): ?User - { - return $this->createdBy; - } - public function getFromPerson(): ?Person { return $this->fromPerson; @@ -134,30 +115,6 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface return $this->toPerson; } - public function getUpdatedAt(): ?\DateTimeImmutable - { - return $this->updatedAt; - } - - public function getUpdatedBy(): ?User - { - return $this->updatedBy; - } - - public function setCreatedAt(\DateTimeInterface $createdAt): self - { - $this->createdAt = $createdAt; - - return $this; - } - - public function setCreatedBy(?User $user): self - { - $this->createdBy = $user; - - return $this; - } - public function setFromPerson(?Person $fromPerson): self { $this->fromPerson = $fromPerson; @@ -185,18 +142,4 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface return $this; } - - public function setUpdatedAt(?\DateTimeInterface $updatedAt): self - { - $this->updatedAt = $updatedAt; - - return $this; - } - - public function setUpdatedBy(?User $updatedBy): self - { - $this->updatedBy = $updatedBy; - - return $this; - } }