<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\LoadInvoiceProductRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
#[ORM\Entity(repositoryClass: LoadInvoiceProductRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['load_invoice:read']],
denormalizationContext: ['groups' => ['load_invoice:write']],
order: ['id' => 'DESC'],
)]
class LoadInvoiceProduct
{
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $article = null;
#[MaxDepth(2)]
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\ManyToOne]
private ?Products $product = null;
#[MaxDepth(1)]
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\ManyToOne]
private ?MeasurmentUnit $uaserment_unit = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(nullable: true)]
private ?int $packaging = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(nullable: true)]
private ?float $count = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(nullable: true)]
private ?float $weight = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(nullable: true)]
private ?float $fact_quantity = null;
#[MaxDepth(1)]
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\ManyToOne]
private ?Storage $storage = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $status = null;
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_entered = null;
#[Groups(['load_invoice:read', 'load_invoice:write'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_modified = null;
#[MaxDepth(1)]
#[Groups(['load_invoice:read', 'load_invoice:write', 'order:read', 'pre_order:read'])]
#[ORM\ManyToOne]
private ?User $measurement_unit = null;
#[ORM\ManyToOne]
private ?User $modified_user = null;
#[ORM\ManyToOne]
private ?User $created_by = null;
#[MaxDepth(3)]
#[Groups(['load_invoice:read', 'load_invoice:write'])]
#[ORM\ManyToOne(inversedBy: 'loadInvoiceProducts')]
private ?OrderProduct $order_product = null;
#[MaxDepth(3)]
#[Groups(['load_invoice:read', 'load_invoice:write'])]
#[ORM\ManyToOne(inversedBy: 'loadInvoiceProducts')]
private ?PreOrder $pre_order_product = null;
#[Groups(['load_invoice:read', 'load_invoice:write'])]
#[ORM\OneToMany(mappedBy: 'load_invoice_product', targetEntity: AcceptedProduct::class)]
private Collection $acceptedProducts;
#[ORM\ManyToOne(inversedBy: 'loadInvoiceProducts', cascade:['persist'])]
private ?LoadInvoice $loadInvoice = null;
#[ORM\Column(nullable: true)]
private ?bool $pdv = null;
public function __construct()
{
$this->acceptedProducts = new ArrayCollection();
}
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 getArticle(): ?string
{
return $this->article;
}
public function setArticle(?string $article): self
{
$this->article = $article;
return $this;
}
public function getProduct(): ?Products
{
return $this->product;
}
public function setProduct(?Products $product): self
{
$this->product = $product;
return $this;
}
public function getUasermentUnit(): ?MeasurmentUnit
{
return $this->uaserment_unit;
}
public function setUasermentUnit(?MeasurmentUnit $uaserment_unit): self
{
$this->uaserment_unit = $uaserment_unit;
return $this;
}
public function getPackaging(): ?int
{
return $this->packaging;
}
public function setPackaging(?int $packaging): self
{
$this->packaging = $packaging;
return $this;
}
public function getCount(): ?float
{
return $this->count;
}
public function setCount(?float $count): self
{
$this->count = $count;
return $this;
}
public function getWeight(): ?float
{
return $this->weight;
}
public function setWeight(?float $weight): self
{
$this->weight = $weight;
return $this;
}
public function getFactQuantity(): ?float
{
return $this->fact_quantity;
}
public function setFactQuantity(?float $fact_quantity): self
{
$this->fact_quantity = $fact_quantity;
return $this;
}
public function getStorage(): ?Storage
{
return $this->storage;
}
public function setStorage(?Storage $storage): self
{
$this->storage = $storage;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->date_entered;
}
public function setDateEntered(?\DateTimeInterface $date_entered): self
{
$this->date_entered = $date_entered;
return $this;
}
public function getDateModified(): ?\DateTimeInterface
{
return $this->date_modified;
}
public function setDateModified(?\DateTimeInterface $date_modified): self
{
$this->date_modified = $date_modified;
return $this;
}
public function getMeasurementUnit(): ?User
{
return $this->measurement_unit;
}
public function setMeasurementUnit(?User $measurement_unit): self
{
$this->measurement_unit = $measurement_unit;
return $this;
}
public function getModifiedUser(): ?User
{
return $this->modified_user;
}
public function setModifiedUser(?User $modified_user): self
{
$this->modified_user = $modified_user;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->created_by;
}
public function setCreatedBy(?User $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getOrderProduct(): ?OrderProduct
{
return $this->order_product;
}
public function setOrderProduct(?OrderProduct $order_product): self
{
$this->order_product = $order_product;
return $this;
}
public function getPreOrderProduct(): ?PreOrder
{
return $this->pre_order_product;
}
public function setPreOrderProduct(?PreOrder $pre_order_product): self
{
$this->pre_order_product = $pre_order_product;
return $this;
}
/**
* @return Collection<int, AcceptedProduct>
*/
public function getAcceptedProducts(): Collection
{
return $this->acceptedProducts;
}
public function addAcceptedProduct(AcceptedProduct $acceptedProduct): self
{
if (!$this->acceptedProducts->contains($acceptedProduct)) {
$this->acceptedProducts->add($acceptedProduct);
$acceptedProduct->setLoadInvoiceProduct($this);
}
return $this;
}
public function removeAcceptedProduct(AcceptedProduct $acceptedProduct): self
{
if ($this->acceptedProducts->removeElement($acceptedProduct)) {
// set the owning side to null (unless already changed)
if ($acceptedProduct->getLoadInvoiceProduct() === $this) {
$acceptedProduct->setLoadInvoiceProduct(null);
}
}
return $this;
}
public function getLoadInvoice(): ?LoadInvoice
{
return $this->loadInvoice;
}
public function setLoadInvoice(?LoadInvoice $loadInvoice): self
{
$this->loadInvoice = $loadInvoice;
return $this;
}
public function isPdv(): ?bool
{
return $this->pdv;
}
public function setPdv(?bool $pdv): self
{
$this->pdv = $pdv;
return $this;
}
}