src/Entity/Material.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MaterialRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=MaterialRepository::class)
  10.  */
  11. class Material
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({
  18.      *     "material.base",
  19.      *     "material.core"
  20.      * })
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=64, unique=true)
  25.      * @Groups({
  26.      *     "material.base",
  27.      *     "material.core"
  28.      * })
  29.      */
  30.     private $alias;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      * @Groups({
  34.      *     "material.base",
  35.      *     "material.core"
  36.      * })
  37.      */
  38.     private $description;
  39.     /**
  40.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  41.      * @Groups({
  42.      *     "material.base",
  43.      *     "material.core"
  44.      * })
  45.      */
  46.     private $price;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="materials")
  49.      * @Groups({
  50.      *     "material.base",
  51.      *     "material.core"
  52.      * })
  53.      */
  54.     private $supplier;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity=MaterialUnitTypes::class, inversedBy="materials")
  57.      * @Groups({
  58.      *     "material.base",
  59.      *     "material.core"
  60.      * })
  61.      */
  62.     private $unit_type;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="material")
  65.      */
  66.     private $inventories;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=SupplierOrders::class, mappedBy="material")
  69.      */
  70.     private $supplierOrders;
  71.     /**
  72.      * @ORM\Column(type="boolean", nullable=true)
  73.      */
  74.     private $editable_content;
  75.     /**
  76.      * @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!"})
  77.      * @Groups({
  78.      *     "material.base",
  79.      *     "material.core"
  80.      * })
  81.      */
  82.     private $content;
  83.     /**
  84.      * @ORM\OneToMany(targetEntity=ProjectOrderExpensePositions::class, mappedBy="material", orphanRemoval=true)
  85.      */
  86.     private $projectOrderExpensePositions;
  87.     /**
  88.      * @ORM\Column(type="string", length=64, nullable=true)
  89.      * @Groups({
  90.      *     "material.base",
  91.      *     "material.core"
  92.      * })
  93.      */
  94.     private $article_nr;
  95.     public function __construct()
  96.     {
  97.         $this->inventories = new ArrayCollection();
  98.         $this->supplierOrders = new ArrayCollection();
  99.         $this->projectOrderExpensePositions = new ArrayCollection();
  100.     }
  101.     public function getId(): ?int
  102.     {
  103.         return $this->id;
  104.     }
  105.     public function getAlias(): ?string
  106.     {
  107.         return $this->alias;
  108.     }
  109.     public function setAlias(string $alias): self
  110.     {
  111.         $this->alias $alias;
  112.         return $this;
  113.     }
  114.     public function getDescription(): ?string
  115.     {
  116.         return $this->description;
  117.     }
  118.     public function setDescription(?string $description): self
  119.     {
  120.         $this->description $description;
  121.         return $this;
  122.     }
  123.     public function getPrice(): ?string
  124.     {
  125.         return $this->price;
  126.     }
  127.     public function setPrice(?string $price): self
  128.     {
  129.         $this->price $price;
  130.         return $this;
  131.     }
  132.     public function getSupplier(): ?Suppliers
  133.     {
  134.         return $this->supplier;
  135.     }
  136.     public function setSupplier(?Suppliers $supplier): self
  137.     {
  138.         $this->supplier $supplier;
  139.         return $this;
  140.     }
  141.     public function getUnitType(): ?MaterialUnitTypes
  142.     {
  143.         return $this->unit_type;
  144.     }
  145.     public function setUnitType(?MaterialUnitTypes $unit_type): self
  146.     {
  147.         $this->unit_type $unit_type;
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection<int, Inventory>
  152.      */
  153.     public function getInventories(): Collection
  154.     {
  155.         return $this->inventories;
  156.     }
  157.     public function addInventory(Inventory $inventory): self
  158.     {
  159.         if (!$this->inventories->contains($inventory)) {
  160.             $this->inventories[] = $inventory;
  161.             $inventory->setMaterial($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeInventory(Inventory $inventory): self
  166.     {
  167.         if ($this->inventories->removeElement($inventory)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($inventory->getMaterial() === $this) {
  170.                 $inventory->setMaterial(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175.     /**
  176.      * @return Collection<int, SupplierOrders>
  177.      */
  178.     public function getSupplierOrders(): Collection
  179.     {
  180.         return $this->supplierOrders;
  181.     }
  182.     public function addSupplierOrder(SupplierOrders $supplierOrder): self
  183.     {
  184.         if (!$this->supplierOrders->contains($supplierOrder)) {
  185.             $this->supplierOrders[] = $supplierOrder;
  186.             $supplierOrder->setMaterial($this);
  187.         }
  188.         return $this;
  189.     }
  190.     public function removeSupplierOrder(SupplierOrders $supplierOrder): self
  191.     {
  192.         if ($this->supplierOrders->removeElement($supplierOrder)) {
  193.             // set the owning side to null (unless already changed)
  194.             if ($supplierOrder->getMaterial() === $this) {
  195.                 $supplierOrder->setMaterial(null);
  196.             }
  197.         }
  198.         return $this;
  199.     }
  200.     public function isEditableContent(): ?bool
  201.     {
  202.         return $this->editable_content;
  203.     }
  204.     public function setEditableContent(?bool $editable_content): self
  205.     {
  206.         $this->editable_content $editable_content;
  207.         return $this;
  208.     }
  209.     public function getContent(): ?string
  210.     {
  211.         return $this->content;
  212.     }
  213.     public function setContent(string $content): self
  214.     {
  215.         $this->content $content;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, ProjectOrderExpensePositions>
  220.      */
  221.     public function getProjectOrderExpensePositions(): Collection
  222.     {
  223.         return $this->projectOrderExpensePositions;
  224.     }
  225.     public function addProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
  226.     {
  227.         if (!$this->projectOrderExpensePositions->contains($projectOrderExpensePosition)) {
  228.             $this->projectOrderExpensePositions[] = $projectOrderExpensePosition;
  229.             $projectOrderExpensePosition->setMaterial($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
  234.     {
  235.         if ($this->projectOrderExpensePositions->removeElement($projectOrderExpensePosition)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($projectOrderExpensePosition->getMaterial() === $this) {
  238.                 $projectOrderExpensePosition->setMaterial(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     public function getArticleNr(): ?string
  244.     {
  245.         return $this->article_nr;
  246.     }
  247.     public function setArticleNr(?string $article_nr): self
  248.     {
  249.         $this->article_nr $article_nr;
  250.         return $this;
  251.     }
  252. }