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