src/Entity/ProjectOrderUndertakings.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectOrderUndertakingsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Doctrine\ORM\Mapping\UniqueConstraint;
  10. /**
  11.  * @deprecated
  12.  *  TODO Remove this Entity forever
  13.  * @see use ProjectOrderBillings
  14.  * @ORM\Entity(repositoryClass=ProjectOrderUndertakingsRepository::class)
  15.  * @ORM\Table(name="project_order_undertakings", uniqueConstraints={
  16.  *          @UniqueConstraint(name="order_unique_invoice_nr", columns={"position_nr", "project_order_id"})
  17.  *     })
  18.  * @UniqueEntity(
  19.  *     fields={"project_order", "position_nr"},
  20.  *     message="Employee already registered|Undertaking with combination (%s %s) is already registered"
  21.  * )
  22.  */
  23. class ProjectOrderUndertakings
  24. {
  25.    /**
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue
  28.      * @ORM\Column(type="integer")
  29.      * @Groups({
  30.     *     "project.order.undertaking.base",
  31.     *     "project.details.orders",
  32.     *     "order.detail",
  33.     *     "vouchers.assigned.order.undertakings",
  34.     *
  35.     *     "project_order_undertaking@core"
  36.     * })
  37.      */
  38.     private $id;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="project_order_undertakings")
  41.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  42.      */
  43.     private $project_order;
  44.     /**
  45.      * @ORM\Column(type="datetime_immutable", nullable=true)
  46.      * @Groups({
  47.      *      "project.order.undertaking.base",
  48.      *      "project.details.orders",
  49.      *      "order.detail",
  50.      *      "vouchers.assigned.order.undertakings",
  51.      *
  52.      *      "project_order_undertaking@core"
  53.      *  })
  54.      */
  55.     private $created_at;
  56.     /**
  57.      * @ORM\Column(type="datetime_immutable", nullable=true)
  58.      * @Groups({
  59.      *       "project.order.undertaking.base",
  60.      *       "project.details.orders",
  61.      *       "order.detail",
  62.      *       "vouchers.assigned.order.undertakings",
  63.      *
  64.      *       "project_order_undertaking@core"
  65.      *   })
  66.      */
  67.     private $sent_at;
  68.     /**
  69.      * @ORM\Column(type="datetime_immutable", nullable=true)
  70.      * @Groups({
  71.      *       "project.order.undertaking.base",
  72.      *       "project.details.orders",
  73.      *       "order.detail",
  74.      *       "vouchers.assigned.order.undertakings",
  75.      *
  76.      *       "project_order_undertaking@core"
  77.      *   })
  78.      */
  79.     private $completed_at;
  80.     /**
  81.      * @ORM\Column(type="string", length=64, nullable=false, options={"comment":"Client undertaking via (Gutschrift) Position number"})
  82.      * @Groups({
  83.      *       "project.order.undertaking.base",
  84.      *       "project.details.orders",
  85.      *       "order.detail",
  86.      *       "vouchers.assigned.order.undertakings",
  87.      *
  88.      *       "project_order_undertaking@core"
  89.      *   })
  90.      */
  91.     private $position_nr;
  92.     /**
  93.      * @ORM\ManyToOne(targetEntity=Vouchers::class, inversedBy="project_order_undertakings")
  94.      * @ORM\JoinColumn(nullable=true)
  95.      * @Groups({
  96.      *       "project.order.undertaking.base",
  97.      *       "project.details.orders",
  98.      *       "order.detail",
  99.      *       "vouchers.assigned.order.undertakings",
  100.      *
  101.      *       "project_order_undertaking@vouchers"
  102.      *   })
  103.      */
  104.     private $voucher;
  105.     /**
  106.      * @ORM\Column(type="float", precision=2, scale=2, nullable=true)
  107.      * @ORM\JoinColumn(nullable=true)
  108.      * @Groups({
  109.      *     "project.order.undertaking.base",
  110.      *     "project.details.orders",
  111.      *     "order.detail",
  112.      *     "vouchers.assigned.order.undertakings",
  113.      *
  114.      *     "project_order_undertaking@core"
  115.      * })
  116.      */
  117.     private $price;
  118.     /**
  119.      * @ORM\OneToMany(targetEntity=InvoicePositions::class, mappedBy="order_undertaking")
  120.      */
  121.     private $invoice_positions;
  122.     public function __construct()
  123.     {
  124.         $this->invoice_positions = new ArrayCollection();
  125.     }
  126.     public function getId(): ?int
  127.     {
  128.         return $this->id;
  129.     }
  130.     public function getProjectOrder(): ?ProjectOrders
  131.     {
  132.         return $this->project_order;
  133.     }
  134.     public function setProjectOrder(?ProjectOrders $project_order): self
  135.     {
  136.         $this->project_order $project_order;
  137.         return $this;
  138.     }
  139.     public function getCreatedAt(): ?\DateTimeImmutable
  140.     {
  141.         return $this->created_at;
  142.     }
  143.     public function setCreatedAt(?\DateTimeImmutable $created_at): self
  144.     {
  145.         $this->created_at $created_at;
  146.         return $this;
  147.     }
  148.     public function getSentAt(): ?\DateTimeImmutable
  149.     {
  150.         return $this->sent_at;
  151.     }
  152.     public function setSentAt(?\DateTimeImmutable $sent_at): self
  153.     {
  154.         $this->sent_at $sent_at;
  155.         return $this;
  156.     }
  157.     public function getCompletedAt(): ?\DateTimeImmutable
  158.     {
  159.         return $this->completed_at;
  160.     }
  161.     public function setCompletedAt(?\DateTimeImmutable $completed_at): self
  162.     {
  163.         $this->completed_at $completed_at;
  164.         return $this;
  165.     }
  166.     public function getPositionNr(): ?string
  167.     {
  168.         return $this->position_nr;
  169.     }
  170.     public function setPositionNr(?string $position_nr): self
  171.     {
  172.         $this->position_nr $position_nr;
  173.         return $this;
  174.     }
  175.     public function getVoucher(): ?Vouchers
  176.     {
  177.         return $this->voucher;
  178.     }
  179.     public function setVoucher(?Vouchers $voucher): self
  180.     {
  181.         $this->voucher $voucher;
  182.         return $this;
  183.     }
  184.     public function getPrice(): ?float
  185.     {
  186.         return $this->price;
  187.     }
  188.     public function setPrice(?float $price): self
  189.     {
  190.         $this->price $price;
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, InvoicePositions>
  195.      */
  196.     public function getInvoicePositions(): Collection
  197.     {
  198.         return $this->invoice_positions;
  199.     }
  200.     public function addInvoicePosition(InvoicePositions $invoicePosition): self
  201.     {
  202.         if (!$this->invoice_positions->contains($invoicePosition)) {
  203.             $this->invoice_positions[] = $invoicePosition;
  204.             $invoicePosition->setOrderUndertaking($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeInvoicePosition(InvoicePositions $invoicePosition): self
  209.     {
  210.         if ($this->invoice_positions->removeElement($invoicePosition)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($invoicePosition->getOrderUndertaking() === $this) {
  213.                 $invoicePosition->setOrderUndertaking(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218. }