<?php
namespace App\Entity;
use App\Repository\SaleOrderInvoiceRepository;
use App\Traits\DateTrait;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SaleOrderInvoiceRepository::class)
*/
class SaleOrderInvoice
{
use DateTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private ?int $id = NULL;
/**
* Numéro de la facture
*
* @ORM\Column(type="string", length=10)
*/
private ?string $reference = NULL;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $name = NULL;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $file = NULL;
/**
* Date de la facture
*
* @ORM\Column(type="datetime_immutable")
*/
private ?DateTimeImmutable $invoiceDate = NULL;
/**
* Commande rattachée
*
* @ORM\OneToOne(targetEntity=SaleOrder::class, mappedBy="invoice", cascade={"persist"})
*/
private ?SaleOrder $saleOrder = NULL;
/**
* @ORM\OneToOne(targetEntity=SaleOrderAddress::class, cascade={"persist", "remove"})
*/
private ?SaleOrderAddress $overrideShippingAddress = NULL;
/**
* @ORM\OneToOne(targetEntity=SaleOrderAddress::class, cascade={"persist", "remove"})
*/
private ?SaleOrderAddress $overrideBillingAddress = NULL;
/**
* @ORM\Column(type="float", nullable=true)
*/
private ?float $overrideShippingPrice = NULL;
/**
* @ORM\Column(type="float", nullable=true)
*/
private ?float $overrideLogisticFeesOrder = NULL;
/**
* @ORM\Column(type="json", nullable=true)
*/
private ?array $overrideItems = NULL;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName( string $name ): self
{
$this->name = $name;
return $this;
}
public function getFile(): ?string
{
return $this->file;
}
public function setFile( string $file ): self
{
$this->file = $file;
return $this;
}
public function getInvoiceDate(): ?DateTimeImmutable
{
return $this->invoiceDate;
}
public function setInvoiceDate( DateTimeImmutable $invoiceDate ): self
{
$this->invoiceDate = $invoiceDate;
return $this;
}
public function getSaleOrder(): ?SaleOrder
{
return $this->saleOrder;
}
public function setSaleOrder( ?SaleOrder $saleOrder ): self
{
// unset the owning side of the relation if necessary
if ( $saleOrder === NULL && $this->saleOrder !== NULL ) {
$this->saleOrder->setInvoice( NULL );
}
// set the owning side of the relation if necessary
if ( $saleOrder !== NULL && $saleOrder->getInvoice() !== $this ) {
$saleOrder->setInvoice( $this );
}
$this->saleOrder = $saleOrder;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference( string $reference ): self
{
$this->reference = $reference;
return $this;
}
public function getOverrideShippingAddress(): ?SaleOrderAddress
{
return $this->overrideShippingAddress;
}
public function setOverrideShippingAddress( ?SaleOrderAddress $overrideShippingAddress ): self
{
$this->overrideShippingAddress = $overrideShippingAddress;
return $this;
}
public function getOverrideBillingAddress(): ?SaleOrderAddress
{
return $this->overrideBillingAddress;
}
public function setOverrideBillingAddress( ?SaleOrderAddress $overrideBillingAddress ): self
{
$this->overrideBillingAddress = $overrideBillingAddress;
return $this;
}
public function getOverrideShippingPrice(): ?float
{
return $this->overrideShippingPrice;
}
public function setOverrideShippingPrice( ?float $overrideShippingPrice ): self
{
$this->overrideShippingPrice = $overrideShippingPrice;
return $this;
}
public function getOverrideLogisticFeesOrder(): ?float
{
return $this->overrideLogisticFeesOrder;
}
public function setOverrideLogisticFeesOrder( ?float $overrideLogisticFeesOrder ): self
{
$this->overrideLogisticFeesOrder = $overrideLogisticFeesOrder;
return $this;
}
public function getOverrideItems(): ?array
{
return $this->overrideItems;
}
public function setOverrideItems( ?array $overrideItems ): self
{
$this->overrideItems = $overrideItems;
return $this;
}
}