<?php
namespace App\Entity;
use App\Repository\StatusRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StatusRepository::class)]
class Status
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $status;
#[ORM\Column(type: 'datetime')]
private $modified;
#[ORM\Column(type: 'datetime')]
private $created;
#[ORM\OneToMany(targetEntity: EventLog::class, mappedBy: 'status')]
private $eventLogs;
#[ORM\OneToMany(targetEntity: OrderStatus::class, mappedBy: 'status')]
private $orderStatuses;
public function __construct()
{
$this->orders = new ArrayCollection();
$this->eventLogs = new ArrayCollection();
$this->orderStatuses = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function setModified(\DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
/**
* @return Collection|Orders[]
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Orders $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setStatus($this);
}
return $this;
}
public function removeOrder(Orders $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getStatus() === $this) {
$order->setStatus(null);
}
}
return $this;
}
/**
* @return Collection|EventLog[]
*/
public function getEventLogs(): Collection
{
return $this->eventLogs;
}
public function addEventLog(EventLog $eventLog): self
{
if (!$this->eventLogs->contains($eventLog)) {
$this->eventLogs[] = $eventLog;
$eventLog->setStatus($this);
}
return $this;
}
public function removeEventLog(EventLog $eventLog): self
{
if ($this->eventLogs->removeElement($eventLog)) {
// set the owning side to null (unless already changed)
if ($eventLog->getStatus() === $this) {
$eventLog->setStatus(null);
}
}
return $this;
}
/**
* @return Collection<int, OrderStatus>
*/
public function getOrderStatuses(): Collection
{
return $this->orderStatuses;
}
public function addOrderStatus(OrderStatus $orderStatus): self
{
if (!$this->orderStatuses->contains($orderStatus)) {
$this->orderStatuses[] = $orderStatus;
$orderStatus->setStatus($this);
}
return $this;
}
public function removeOrderStatus(OrderStatus $orderStatus): self
{
if ($this->orderStatuses->removeElement($orderStatus)) {
// set the owning side to null (unless already changed)
if ($orderStatus->getStatus() === $this) {
$orderStatus->setStatus(null);
}
}
return $this;
}
}