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.      * TODO onDelete setNull Olarak degistir
  32.      * This stock issue does not necessarily have to be linked to a project order — it may have been issued for another reason.
  33.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="stock_issues")
  34.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  35.      * @Groups({
  36.      *      "stock_issue@project_order",
  37.      *      })
  38.      */
  39.     private $project_order;
  40.     /**
  41.      * Absolute should be user
  42.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="stock_out_issues")
  43.      * @ORM\JoinColumn(nullable=false, options={})
  44.      * @Groups({
  45.      *     "stock_issue@issued_by"
  46.      * })
  47.      */
  48.     private $issued_by;
  49.     /**
  50.      * @see issue_to_employee_activity
  51.      * use issue_to_employee_activity
  52.      * @deprecated use issue_to_employee_activity
  53.      * Absolute should not be user, although it worker, can any person be issued stock
  54.      * @ORM\ManyToOne(targetEntity=Worker::class)
  55.      * @Groups({
  56.      *     "stock_issue@issued_to"
  57.      * })
  58.      */
  59.     private $issued_to;
  60.     /**
  61.      * @ORM\Column(type="datetime_immutable", nullable=true)
  62.      * @Groups({
  63.      *      "stock_issue@core",
  64.      *      })
  65.      */
  66.     private $delivered_at;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      * @Groups({
  70.      *      "stock_issue@core",
  71.      *      })
  72.      */
  73.     private $notes;
  74.     /**
  75.      * @ORM\Column(type="datetime_immutable")
  76.      * @Groups({
  77.      *      "stock_issue@core",
  78.      *      })
  79.      */
  80.     private $created_at;
  81.     /**
  82.      * @ORM\Column(type="datetime_immutable", nullable=true)
  83.      * @Groups({
  84.      *       "stock_issue@core",
  85.      *       })
  86.      */
  87.     private $updated_at;
  88.     /**
  89.      * @ORM\OneToMany(targetEntity=StockIssuePositions::class, mappedBy="stock_issue", cascade={"persist", "remove"}, orphanRemoval=true)
  90.      * @Groups({
  91.      *        "stock_issue@positions",
  92.      *        })
  93.      */
  94.     private $stock_issue_positions;
  95.     /**
  96.      * @see issued_to
  97.      * @ORM\ManyToOne(targetEntity=WorkerActivities::class, inversedBy="stockIssues")
  98.      * @Groups({
  99.      *      "stock_issue@issued_to_worker_actiyity"
  100.      * })
  101.      */
  102.     private $issue_to_employee_activity;
  103.     public function __construct()
  104.     {
  105.         $this->stock_issue_positions = new ArrayCollection();
  106.     }
  107.     public function getId(): ?int
  108.     {
  109.         return $this->id;
  110.     }
  111.     public function getIssueName(): ?string
  112.     {
  113.         return $this->issue_name;
  114.     }
  115.     public function setIssueName(string $issue_name): self
  116.     {
  117.         $this->issue_name $issue_name;
  118.         return $this;
  119.     }
  120.     public function getProjectOrder(): ?ProjectOrders
  121.     {
  122.         return $this->project_order;
  123.     }
  124.     public function setProjectOrder(?ProjectOrders $project_order): self
  125.     {
  126.         $this->project_order $project_order;
  127.         return $this;
  128.     }
  129.     public function getIssuedBy(): ?User
  130.     {
  131.         return $this->issued_by;
  132.     }
  133.     public function setIssuedBy(?User $issued_by): self
  134.     {
  135.         $this->issued_by $issued_by;
  136.         return $this;
  137.     }
  138.     public function getIssuedTo(): ?Worker
  139.     {
  140.         return $this->issued_to;
  141.     }
  142.     public function setIssuedTo(?Worker $issued_to): self
  143.     {
  144.         $this->issued_to $issued_to;
  145.         return $this;
  146.     }
  147.     public function getDeliveredAt(): ?\DateTimeImmutable
  148.     {
  149.         return $this->delivered_at;
  150.     }
  151.     public function setDeliveredAt(?\DateTimeImmutable $delivered_at): self
  152.     {
  153.         $this->delivered_at $delivered_at;
  154.         return $this;
  155.     }
  156.     public function getNotes(): ?string
  157.     {
  158.         return $this->notes;
  159.     }
  160.     public function setNotes(?string $notes): self
  161.     {
  162.         $this->notes $notes;
  163.         return $this;
  164.     }
  165.     public function getCreatedAt(): ?\DateTimeImmutable
  166.     {
  167.         return $this->created_at;
  168.     }
  169.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  170.     {
  171.         $this->created_at $created_at;
  172.         return $this;
  173.     }
  174.     public function getUpdatedAt(): ?\DateTimeImmutable
  175.     {
  176.         return $this->updated_at;
  177.     }
  178.     public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
  179.     {
  180.         $this->updated_at $updated_at;
  181.         return $this;
  182.     }
  183.     /**
  184.      * @return Collection<int, StockIssuePositions>
  185.      */
  186.     public function getStockIssuePositions(): Collection
  187.     {
  188.         return $this->stock_issue_positions;
  189.     }
  190.     public function addStockIssuePosition(StockIssuePositions $stockIssuePosition): self
  191.     {
  192.         if (!$this->stock_issue_positions->contains($stockIssuePosition)) {
  193.             $this->stock_issue_positions[] = $stockIssuePosition;
  194.             $stockIssuePosition->setStockIssue($this);
  195.         }
  196.         return $this;
  197.     }
  198.     public function removeStockIssuePosition(StockIssuePositions $stockIssuePosition): self
  199.     {
  200.         if ($this->stock_issue_positions->removeElement($stockIssuePosition)) {
  201.             // set the owning side to null (unless already changed)
  202.             if ($stockIssuePosition->getStockIssue() === $this) {
  203.                 $stockIssuePosition->setStockIssue(null);
  204.             }
  205.         }
  206.         return $this;
  207.     }
  208.     public function getIssueToEmployeeActivity(): ?WorkerActivities
  209.     {
  210.         return $this->issue_to_employee_activity;
  211.     }
  212.     public function setIssueToEmployeeActivity(?WorkerActivities $issue_to_employee_activity): self
  213.     {
  214.         $this->issue_to_employee_activity $issue_to_employee_activity;
  215.         return $this;
  216.     }
  217. }