<?php
namespace App\Entity;
use App\Repository\MaterialRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=MaterialRepository::class)
*/
class Material
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=64, unique=true)
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $alias;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $description;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $price;
/**
* @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="materials")
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $supplier;
/**
* @ORM\ManyToOne(targetEntity=MaterialUnitTypes::class, inversedBy="materials")
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $unit_type;
/**
* @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="material")
*/
private $inventories;
/**
* @ORM\OneToMany(targetEntity=SupplierOrders::class, mappedBy="material")
*/
private $supplierOrders;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $editable_content;
/**
* @ORM\Column(type="text", nullable=true, options={"comment": "Material content either static or dynamic by dynanic use can this editable and using as pattern, by static use can useable ad material name!"})
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $content;
/**
* @ORM\OneToMany(targetEntity=ProjectOrderExpensePositions::class, mappedBy="material", orphanRemoval=true)
*/
private $projectOrderExpensePositions;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({
* "material.base",
* "material.core"
* })
*/
private $article_nr;
public function __construct()
{
$this->inventories = new ArrayCollection();
$this->supplierOrders = new ArrayCollection();
$this->projectOrderExpensePositions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getAlias(): ?string
{
return $this->alias;
}
public function setAlias(string $alias): self
{
$this->alias = $alias;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPrice(): ?string
{
return $this->price;
}
public function setPrice(?string $price): self
{
$this->price = $price;
return $this;
}
public function getSupplier(): ?Suppliers
{
return $this->supplier;
}
public function setSupplier(?Suppliers $supplier): self
{
$this->supplier = $supplier;
return $this;
}
public function getUnitType(): ?MaterialUnitTypes
{
return $this->unit_type;
}
public function setUnitType(?MaterialUnitTypes $unit_type): self
{
$this->unit_type = $unit_type;
return $this;
}
/**
* @return Collection<int, Inventory>
*/
public function getInventories(): Collection
{
return $this->inventories;
}
public function addInventory(Inventory $inventory): self
{
if (!$this->inventories->contains($inventory)) {
$this->inventories[] = $inventory;
$inventory->setMaterial($this);
}
return $this;
}
public function removeInventory(Inventory $inventory): self
{
if ($this->inventories->removeElement($inventory)) {
// set the owning side to null (unless already changed)
if ($inventory->getMaterial() === $this) {
$inventory->setMaterial(null);
}
}
return $this;
}
/**
* @return Collection<int, SupplierOrders>
*/
public function getSupplierOrders(): Collection
{
return $this->supplierOrders;
}
public function addSupplierOrder(SupplierOrders $supplierOrder): self
{
if (!$this->supplierOrders->contains($supplierOrder)) {
$this->supplierOrders[] = $supplierOrder;
$supplierOrder->setMaterial($this);
}
return $this;
}
public function removeSupplierOrder(SupplierOrders $supplierOrder): self
{
if ($this->supplierOrders->removeElement($supplierOrder)) {
// set the owning side to null (unless already changed)
if ($supplierOrder->getMaterial() === $this) {
$supplierOrder->setMaterial(null);
}
}
return $this;
}
public function isEditableContent(): ?bool
{
return $this->editable_content;
}
public function setEditableContent(?bool $editable_content): self
{
$this->editable_content = $editable_content;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
/**
* @return Collection<int, ProjectOrderExpensePositions>
*/
public function getProjectOrderExpensePositions(): Collection
{
return $this->projectOrderExpensePositions;
}
public function addProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
{
if (!$this->projectOrderExpensePositions->contains($projectOrderExpensePosition)) {
$this->projectOrderExpensePositions[] = $projectOrderExpensePosition;
$projectOrderExpensePosition->setMaterial($this);
}
return $this;
}
public function removeProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
{
if ($this->projectOrderExpensePositions->removeElement($projectOrderExpensePosition)) {
// set the owning side to null (unless already changed)
if ($projectOrderExpensePosition->getMaterial() === $this) {
$projectOrderExpensePosition->setMaterial(null);
}
}
return $this;
}
public function getArticleNr(): ?string
{
return $this->article_nr;
}
public function setArticleNr(?string $article_nr): self
{
$this->article_nr = $article_nr;
return $this;
}
}