<?php
namespace App\Entity;
use App\Repository\OrderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[ORM\Table(name: '`order`')]
class Order
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private int $id;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
#[Assert\NotBlank]
#[Assert\Type(\DateTime::class)]
private \DateTimeInterface $issuedAt;
#[ORM\Column]
#[Assert\NotBlank]
private bool $paid = false;
#[ORM\Column]
#[Assert\NotBlank]
private int $variableSymbol;
#[ORM\OneToMany(mappedBy: 'order', targetEntity: Picture::class)]
#[ORM\JoinColumn(name: "order_id", referencedColumnName: "id", nullable: false)]
private Collection $pictures;
#[ORM\ManyToOne(inversedBy: 'orders')]
#[ORM\JoinColumn(nullable: true)]
private ?User $user;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private \DateTimeInterface $deliveryDate;
#[ORM\Column(length: 255)]
private ?string $code = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2, nullable: false)]
private string $price;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryCity = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryStreet1 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryStreet2 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryZipCode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryState = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryFirstname = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryLastname = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $deliveryPhone = null;
#[ORM\Column(length: 180, nullable: true)]
#[Assert\NotBlank]
#[Assert\Email]
private ?string $deliveryEmail = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $paymentId = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: '0')]
private ?string $finalPrice = null;
#[ORM\Column(length: 255, nullable: false)]
private string $billingState;
#[ORM\Column(length: 255, nullable: false)]
private string $billingCity;
#[ORM\Column(length: 255, nullable: false)]
private string $billingZipCode;
#[ORM\Column(length: 255, nullable: false)]
private string $billingStreet;
#[ORM\Column(length: 255, nullable: true)]
private ?string $billingStreet2 = null;
#[ORM\Column(length: 255, nullable: false)]
private string $billingPhone;
#[ORM\Column(length: 255, nullable: false)]
private string $billingEmail;
#[ORM\Column(length: 255, nullable: false)]
private string $billingFirstname;
#[ORM\Column(length: 255, nullable: false)]
private string $billingLastname;
#[ORM\Column(type: Types::TEXT, length: 65535)]
private ?string $text = null;
#[ORM\OneToOne(inversedBy: 'associatedOrder', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: true)]
private ?Invoice $invoice = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Template $template = null;
public function __construct()
{
$this->pictures = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id): self
{
$this->id = $id;
return $this;
}
public function getIssuedAt(): ?\DateTimeInterface
{
return $this->issuedAt;
}
public function setIssuedAt(\DateTimeInterface $issuedAt): self
{
$this->issuedAt = $issuedAt;
return $this;
}
public function isPaid(): ?bool
{
return $this->paid;
}
public function setPaid(bool $paid): self
{
$this->paid = $paid;
return $this;
}
public function getVariableSymbol(): ?int
{
return $this->variableSymbol;
}
public function setVariableSymbol(int $variableSymbol): self
{
$this->variableSymbol = $variableSymbol;
return $this;
}
/**
* @return Collection<int, Picture>
*/
public function getPictures(): Collection
{
return $this->pictures;
}
public function addPicture(Picture $picture): self
{
if (!$this->pictures->contains($picture)) {
$this->pictures->add($picture);
$picture->setOrderId($this);
}
return $this;
}
public function removePicture(Picture $picture): self
{
if ($this->pictures->removeElement($picture)) {
// set the owning side to null (unless already changed)
if ($picture->getOrderId() === $this) {
$picture->setOrderId(null);
}
}
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getDeliveryDate(): ?\DateTimeInterface
{
return $this->deliveryDate;
}
public function setDeliveryDate(\DateTimeInterface $deliveryDate): self
{
$this->deliveryDate = $deliveryDate;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getPrice(): string
{
return $this->price;
}
public function setPrice(string $price): self
{
$this->price = $price;
return $this;
}
public function getDeliveryCity(): ?string
{
return $this->deliveryCity;
}
public function setDeliveryCity(string $deliveryCity): self
{
$this->deliveryCity = $deliveryCity;
return $this;
}
public function getDeliveryStreet1(): ?string
{
return $this->deliveryStreet1;
}
public function setDeliveryStreet1(string $deliveryStreet1): self
{
$this->deliveryStreet1 = $deliveryStreet1;
return $this;
}
public function getDeliveryStreet2(): ?string
{
return $this->deliveryStreet2;
}
public function setDeliveryStreet2(string $deliveryStreet2): self
{
$this->deliveryStreet2 = $deliveryStreet2;
return $this;
}
public function getDeliveryZipCode(): ?string
{
return $this->deliveryZipCode;
}
public function setDeliveryZipCode(string $deliveryZipCode): self
{
$this->deliveryZipCode = $deliveryZipCode;
return $this;
}
public function getDeliveryState(): ?string
{
return $this->deliveryState;
}
public function setDeliveryState(string $deliveryState): self
{
$this->deliveryState = $deliveryState;
return $this;
}
public function getDeliveryFirstname(): ?string
{
return $this->deliveryFirstname;
}
public function setDeliveryFirstname(string $deliveryFirstname): self
{
$this->deliveryFirstname = $deliveryFirstname;
return $this;
}
public function getDeliveryLastname(): ?string
{
return $this->deliveryLastname;
}
public function setDeliveryLastname(string $deliveryLastname): self
{
$this->deliveryLastname = $deliveryLastname;
return $this;
}
public function getDeliveryPhone(): ?string
{
return $this->deliveryPhone;
}
public function setDeliveryPhone(string $deliveryPhone): self
{
$this->deliveryPhone = $deliveryPhone;
return $this;
}
public function getDeliveryEmail(): ?string
{
return $this->deliveryEmail;
}
public function setDeliveryEmail(string $deliveryEmail): self
{
$this->deliveryEmail = $deliveryEmail;
return $this;
}
public function getPaymentId(): ?string
{
return $this->paymentId;
}
public function setPaymentId(string $paymentId): self
{
$this->paymentId = $paymentId;
return $this;
}
public function getFinalPrice(): ?string
{
return $this->finalPrice;
}
public function setFinalPrice(string $finalPrice): self
{
$this->finalPrice = $finalPrice;
return $this;
}
public function getBillingState(): string
{
return $this->billingState;
}
public function setBillingState(string $billingState): self
{
$this->billingState = $billingState;
return $this;
}
public function getBillingCity(): string
{
return $this->billingCity;
}
public function setBillingCity(string $billingCity): self
{
$this->billingCity = $billingCity;
return $this;
}
public function getBillingZipCode(): string
{
return $this->billingZipCode;
}
public function setBillingZipCode(string $billingZipCode): self
{
$this->billingZipCode = $billingZipCode;
return $this;
}
public function getBillingStreet(): string
{
return $this->billingStreet;
}
public function setBillingStreet(string $billingStreet): self
{
$this->billingStreet = $billingStreet;
return $this;
}
public function getBillingStreet2(): ?string
{
return $this->billingStreet2;
}
public function setBillingStreet2(string $billingStreet2): self
{
$this->billingStreet2 = $billingStreet2;
return $this;
}
public function getBillingPhone(): string
{
return $this->billingPhone;
}
public function setBillingPhone(string $billingPhone): self
{
$this->billingPhone = $billingPhone;
return $this;
}
public function getBillingEmail(): string
{
return $this->billingEmail;
}
public function setBillingEmail(string $billingEmail): self
{
$this->billingEmail = $billingEmail;
return $this;
}
public function getBillingFirstname(): string
{
return $this->billingFirstname;
}
public function setBillingFirstname(string $billingFirstname): self
{
$this->billingFirstname = $billingFirstname;
return $this;
}
public function getBillingLastname(): string
{
return $this->billingLastname;
}
public function setBillingLastname(string $billingLastname): self
{
$this->billingLastname = $billingLastname;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(string $text): self
{
$this->text = $text;
return $this;
}
public function getInvoice(): ?Invoice
{
return $this->invoice;
}
public function setInvoice(Invoice $invoice): self
{
$this->invoice = $invoice;
return $this;
}
public function getTemplate(): ?Template
{
return $this->template;
}
public function setTemplate(?Template $template): self
{
$this->template = $template;
return $this;
}
public function __toString(): string
{
// Replace 'id' with the property you want to use to represent the Order
return (string) $this->id;
}
}