src/Entity/Gos/BufferedShopOrderPartChangeLog.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Enum\BufferedShopOrderStatus;
  4. use App\Repository\Gos\BufferedShopOrderPartChangeLogRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass=BufferedShopOrderPartChangeLogRepository::class)
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class BufferedShopOrderPartChangeLog
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private ?int $id null;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=OrderPart::class, inversedBy="bufferedShopChangeLogs")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private OrderPart $orderPart;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true, enumType="App\Enum\BufferedShopOrderStatus")
  25.      */
  26.     private ?BufferedShopOrderStatus $oldStatus null;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true, enumType="App\Enum\BufferedShopOrderStatus")
  29.      */
  30.     private ?BufferedShopOrderStatus $newStatus null;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private ?string $oldComment null;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private ?string $newComment null;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=User::class)
  41.      * @ORM\JoinColumn(nullable=false)
  42.      */
  43.     private User $changedBy;
  44.     /**
  45.      * @ORM\Column(type="datetime_immutable")
  46.      */
  47.     private \DateTimeImmutable $changedAt;
  48.     /** @ORM\PrePersist() */
  49.     public function prePersist(): void
  50.     {
  51.         $this->changedAt = new \DateTimeImmutable();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getOrderPart(): OrderPart
  58.     {
  59.         return $this->orderPart;
  60.     }
  61.     public function setOrderPart(OrderPart $orderPart): self
  62.     {
  63.         $this->orderPart $orderPart;
  64.         return $this;
  65.     }
  66.     public function getOldStatus(): ?BufferedShopOrderStatus
  67.     {
  68.         return $this->oldStatus;
  69.     }
  70.     public function setOldStatus(?BufferedShopOrderStatus $oldStatus): self
  71.     {
  72.         $this->oldStatus $oldStatus;
  73.         return $this;
  74.     }
  75.     public function getNewStatus(): ?BufferedShopOrderStatus
  76.     {
  77.         return $this->newStatus;
  78.     }
  79.     public function setNewStatus(?BufferedShopOrderStatus $newStatus): self
  80.     {
  81.         $this->newStatus $newStatus;
  82.         return $this;
  83.     }
  84.     public function getOldComment(): ?string
  85.     {
  86.         return $this->oldComment;
  87.     }
  88.     public function setOldComment(?string $oldComment): self
  89.     {
  90.         $this->oldComment $oldComment !== '' $oldComment null;
  91.         return $this;
  92.     }
  93.     public function getNewComment(): ?string
  94.     {
  95.         return $this->newComment;
  96.     }
  97.     public function setNewComment(?string $newComment): self
  98.     {
  99.         $this->newComment $newComment !== '' $newComment null;
  100.         return $this;
  101.     }
  102.     public function getChangedBy(): User
  103.     {
  104.         return $this->changedBy;
  105.     }
  106.     public function setChangedBy(User $changedBy): self
  107.     {
  108.         $this->changedBy $changedBy;
  109.         return $this;
  110.     }
  111.     public function getChangedAt(): \DateTimeImmutable
  112.     {
  113.         return $this->changedAt;
  114.     }
  115.     public function hasStatusChanged(): bool
  116.     {
  117.         return $this->oldStatus !== $this->newStatus;
  118.     }
  119.     public function hasCommentChanged(): bool
  120.     {
  121.         return $this->oldComment !== $this->newComment;
  122.     }
  123. }