src/Entity/StockIssue.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StockIssueRepository;
  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=StockIssueRepository::class)
  10.  * @ORM\Table(name="stock_issue", options={"comment":"This table stores stock issues and related with Stock transactions"})
  11.  */
  12. class StockIssue
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      * @Groups({
  19.      *     "stock_issue@core",
  20.      *     })
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      * @Groups({
  26.      *      "stock_issue@core",
  27.      *      })
  28.      */
  29.     private $issue_name;
  30.     /**
  31.      * This stock issue does not necessarily have to be linked to a project order — it may have been issued for another reason.
  32.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="stock_issues")
  33.      * @ORM\JoinColumn(nullable=true)
  34.      * @Groups({
  35.      *      "stock_issue@project_order",
  36.      *      })
  37.      */
  38.     private $project_order;
  39.     /**
  40.      * Absolute should be user
  41.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="stock_out_issues")
  42.      * @ORM\JoinColumn(nullable=false, options={})
  43.      * @Groups({
  44.      *      "stock_issue@issued_by",
  45.      *      })
  46.      */
  47.     private $issued_by;
  48.     /**
  49.      * Absolute should not be user, although it worker, can any person be issued stock
  50.      * @ORM\ManyToOne(targetEntity=Worker::class)
  51.      * @Groups({
  52.      *      "stock_issue@issued_to",
  53.      *      })
  54.      */
  55.     private $issued_to;
  56.     /**
  57.      * @ORM\Column(type="datetime_immutable", nullable=true)
  58.      * @Groups({
  59.      *      "stock_issue@core",
  60.      *      })
  61.      */
  62.     private $delivered_at;
  63.     /**
  64.      * @ORM\Column(type="string", length=255, nullable=true)
  65.      * @Groups({
  66.      *      "stock_issue@core",
  67.      *      })
  68.      */
  69.     private $notes;
  70.     /**
  71.      * @ORM\Column(type="datetime_immutable")
  72.      * @Groups({
  73.      *      "stock_issue@core",
  74.      *      })
  75.      */
  76.     private $created_at;
  77.     /**
  78.      * @ORM\Column(type="datetime_immutable", nullable=true)
  79.      * @Groups({
  80.      *       "stock_issue@core",
  81.      *       })
  82.      */
  83.     private $updated_at;
  84.     /**
  85.      * @ORM\OneToMany(targetEntity=StockIssuePositions::class, mappedBy="stock_issue", cascade={"persist", "remove"}, orphanRemoval=true)
  86.      * @Groups({
  87.      *        "stock_issue@positions",
  88.      *        })
  89.      */
  90.     private $stock_issue_positions;
  91.     public function __construct()
  92.     {
  93.         $this->stock_issue_positions = new ArrayCollection();
  94.     }
  95.     public function getId(): ?int
  96.     {
  97.         return $this->id;
  98.     }
  99.     public function getIssueName(): ?string
  100.     {
  101.         return $this->issue_name;
  102.     }
  103.     public function setIssueName(string $issue_name): self
  104.     {
  105.         $this->issue_name $issue_name;
  106.         return $this;
  107.     }
  108.     public function getProjectOrder(): ?ProjectOrders
  109.     {
  110.         return $this->project_order;
  111.     }
  112.     public function setProjectOrder(?ProjectOrders $project_order): self
  113.     {
  114.         $this->project_order $project_order;
  115.         return $this;
  116.     }
  117.     public function getIssuedBy(): ?User
  118.     {
  119.         return $this->issued_by;
  120.     }
  121.     public function setIssuedBy(?User $issued_by): self
  122.     {
  123.         $this->issued_by $issued_by;
  124.         return $this;
  125.     }
  126.     public function getIssuedTo(): ?Worker
  127.     {
  128.         return $this->issued_to;
  129.     }
  130.     public function setIssuedTo(?Worker $issued_to): self
  131.     {
  132.         $this->issued_to $issued_to;
  133.         return $this;
  134.     }
  135.     public function getDeliveredAt(): ?\DateTimeImmutable
  136.     {
  137.         return $this->delivered_at;
  138.     }
  139.     public function setDeliveredAt(?\DateTimeImmutable $delivered_at): self
  140.     {
  141.         $this->delivered_at $delivered_at;
  142.         return $this;
  143.     }
  144.     public function getNotes(): ?string
  145.     {
  146.         return $this->notes;
  147.     }
  148.     public function setNotes(?string $notes): self
  149.     {
  150.         $this->notes $notes;
  151.         return $this;
  152.     }
  153.     public function getCreatedAt(): ?\DateTimeImmutable
  154.     {
  155.         return $this->created_at;
  156.     }
  157.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  158.     {
  159.         $this->created_at $created_at;
  160.         return $this;
  161.     }
  162.     public function getUpdatedAt(): ?\DateTimeImmutable
  163.     {
  164.         return $this->updated_at;
  165.     }
  166.     public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
  167.     {
  168.         $this->updated_at $updated_at;
  169.         return $this;
  170.     }
  171.     /**
  172.      * @return Collection<int, StockIssuePositions>
  173.      */
  174.     public function getStockIssuePositions(): Collection
  175.     {
  176.         return $this->stock_issue_positions;
  177.     }
  178.     public function addStockIssuePosition(StockIssuePositions $stockIssuePosition): self
  179.     {
  180.         if (!$this->stock_issue_positions->contains($stockIssuePosition)) {
  181.             $this->stock_issue_positions[] = $stockIssuePosition;
  182.             $stockIssuePosition->setStockIssue($this);
  183.         }
  184.         return $this;
  185.     }
  186.     public function removeStockIssuePosition(StockIssuePositions $stockIssuePosition): self
  187.     {
  188.         if ($this->stock_issue_positions->removeElement($stockIssuePosition)) {
  189.             // set the owning side to null (unless already changed)
  190.             if ($stockIssuePosition->getStockIssue() === $this) {
  191.                 $stockIssuePosition->setStockIssue(null);
  192.             }
  193.         }
  194.         return $this;
  195.     }
  196. }