<?php
namespace App\Entity\Gos;
use App\Enum\BufferedShopOrderStatus;
use App\Repository\Gos\BufferedShopOrderPartChangeLogRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=BufferedShopOrderPartChangeLogRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class BufferedShopOrderPartChangeLog
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=OrderPart::class, inversedBy="bufferedShopChangeLogs")
* @ORM\JoinColumn(nullable=false)
*/
private OrderPart $orderPart;
/**
* @ORM\Column(type="string", length=255, nullable=true, enumType="App\Enum\BufferedShopOrderStatus")
*/
private ?BufferedShopOrderStatus $oldStatus = null;
/**
* @ORM\Column(type="string", length=255, nullable=true, enumType="App\Enum\BufferedShopOrderStatus")
*/
private ?BufferedShopOrderStatus $newStatus = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $oldComment = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $newComment = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private User $changedBy;
/**
* @ORM\Column(type="datetime_immutable")
*/
private \DateTimeImmutable $changedAt;
/** @ORM\PrePersist() */
public function prePersist(): void
{
$this->changedAt = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getOrderPart(): OrderPart
{
return $this->orderPart;
}
public function setOrderPart(OrderPart $orderPart): self
{
$this->orderPart = $orderPart;
return $this;
}
public function getOldStatus(): ?BufferedShopOrderStatus
{
return $this->oldStatus;
}
public function setOldStatus(?BufferedShopOrderStatus $oldStatus): self
{
$this->oldStatus = $oldStatus;
return $this;
}
public function getNewStatus(): ?BufferedShopOrderStatus
{
return $this->newStatus;
}
public function setNewStatus(?BufferedShopOrderStatus $newStatus): self
{
$this->newStatus = $newStatus;
return $this;
}
public function getOldComment(): ?string
{
return $this->oldComment;
}
public function setOldComment(?string $oldComment): self
{
$this->oldComment = $oldComment !== '' ? $oldComment : null;
return $this;
}
public function getNewComment(): ?string
{
return $this->newComment;
}
public function setNewComment(?string $newComment): self
{
$this->newComment = $newComment !== '' ? $newComment : null;
return $this;
}
public function getChangedBy(): User
{
return $this->changedBy;
}
public function setChangedBy(User $changedBy): self
{
$this->changedBy = $changedBy;
return $this;
}
public function getChangedAt(): \DateTimeImmutable
{
return $this->changedAt;
}
public function hasStatusChanged(): bool
{
return $this->oldStatus !== $this->newStatus;
}
public function hasCommentChanged(): bool
{
return $this->oldComment !== $this->newComment;
}
}