<?php
namespace App\Entity;
use App\Repository\OrderDetailsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OrderDetailsRepository::class)]
class OrderDetails
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'orderDetails')]
private $user;
#[ORM\Column(type: 'float', nullable: true)]
private $total;
#[ORM\Column(type: 'datetime', nullable: true)]
private $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private $modifiedAt;
#[ORM\OneToMany(mappedBy: 'orderDetails', targetEntity: OrderItems::class, cascade: ['persist', 'remove'])]
private $orderItems;
#[ORM\OneToOne(inversedBy: 'orderDetails', targetEntity: OrderBillingDetails::class, cascade: ['persist', 'remove'])]
private $orderBillingDetails;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $xeroId;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $type;
#[ORM\OneToOne(mappedBy: 'orderDetails', targetEntity: PaymentDetails::class, cascade: ['persist', 'remove'])]
private $paymentDetails;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $invoiceNumber;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $transactionId;
#[ORM\Column(length: 255, nullable: true)]
private ?string $salesforceId = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?FilmProject $filmProject = null;
#[ORM\OneToOne(mappedBy: 'orderDetails', targetEntity: Donation::class, cascade: ['persist', 'remove'])]
private $donation = null;
#[ORM\Column(nullable: true)]
private ?bool $isRefund = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $refundXeroId = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $xeroContactId = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $popupSalesforceId = null;
public function __construct()
{
$this->orderItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getTotal(): ?float
{
return $this->total;
}
public function setTotal(?float $total): self
{
$this->total = $total;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getModifiedAt(): ?\DateTimeInterface
{
return $this->modifiedAt;
}
public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
{
$this->modifiedAt = $modifiedAt;
return $this;
}
/**
* @return Collection<int, OrderItems>
*/
public function getOrderItems(): Collection
{
return $this->orderItems;
}
public function addOrderItem(OrderItems $orderItem): self
{
if (!$this->orderItems->contains($orderItem)) {
$this->orderItems[] = $orderItem;
$orderItem->setOrderDetails($this);
}
return $this;
}
public function removeOrderItem(OrderItems $orderItem): self
{
if ($this->orderItems->removeElement($orderItem)) {
// set the owning side to null (unless already changed)
if ($orderItem->getOrderDetails() === $this) {
$orderItem->setOrderDetails(null);
}
}
return $this;
}
public function getOrderBillingDetails(): ?OrderBillingDetails
{
return $this->orderBillingDetails;
}
public function setOrderBillingDetails(?OrderBillingDetails $orderBillingDetails): self
{
$this->orderBillingDetails = $orderBillingDetails;
return $this;
}
public function getXeroId(): ?string
{
return $this->xeroId;
}
public function setXeroId(?string $xeroId): self
{
$this->xeroId = $xeroId;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getPaymentDetails(): ?PaymentDetails
{
return $this->paymentDetails;
}
public function setPaymentDetails(?PaymentDetails $paymentDetails): self
{
// unset the owning side of the relation if necessary
if ($paymentDetails === null && $this->paymentDetails !== null) {
$this->paymentDetails->setOrderDetails(null);
}
// set the owning side of the relation if necessary
if ($paymentDetails !== null && $paymentDetails->getOrderDetails() !== $this) {
$paymentDetails->setOrderDetails($this);
}
$this->paymentDetails = $paymentDetails;
return $this;
}
public function getInvoiceNumber(): ?string
{
return $this->invoiceNumber;
}
public function setInvoiceNumber(?string $invoiceNumber): self
{
$this->invoiceNumber = $invoiceNumber;
return $this;
}
public function getTransactionId(): ?string
{
return $this->transactionId;
}
public function setTransactionId(?string $transactionId): self
{
$this->transactionId = $transactionId;
return $this;
}
public function getSalesforceId(): ?string
{
return $this->salesforceId;
}
public function setSalesforceId(?string $salesforceId): self
{
$this->salesforceId = $salesforceId;
return $this;
}
public function getFilmProject(): ?FilmProject
{
return $this->filmProject;
}
public function setFilmProject(?FilmProject $filmProject): self
{
$this->filmProject = $filmProject;
return $this;
}
public function getDonation(): ?Donation
{
return $this->donation;
}
public function setDonation(?Donation $donation): self
{
$this->donation = $donation;
return $this;
}
public function getProjectTitle(): string
{
if ($this->donation) {
$filmProject = $this->donation->getFilmProject();
if ($filmProject)
return $filmProject->getTitle();
}
if ($this->filmProject)
return $this->filmProject->getTitle();
return 'Documentary Australia';
}
public function getMwId()
{
return 'MW'. $this->id;
}
public function isIsRefund(): ?bool
{
return $this->isRefund;
}
public function setIsRefund(?bool $isRefund): self
{
$this->isRefund = $isRefund;
return $this;
}
public function getRefundXeroId(): ?string
{
return $this->refundXeroId;
}
public function setRefundXeroId(?string $refundXeroId): self
{
$this->refundXeroId = $refundXeroId;
return $this;
}
public function getXeroContactId(): ?string
{
return $this->xeroContactId;
}
public function setXeroContactId(?string $xeroContactId): self
{
$this->xeroContactId = $xeroContactId;
return $this;
}
public function getPopupSalesforceId(): ?string
{
return $this->popupSalesforceId;
}
public function setPopupSalesforceId(?string $popupSalesforceId): self
{
$this->popupSalesforceId = $popupSalesforceId;
return $this;
}
}