src/Modules/TicketCart/Entity/TicketOrderTicket.php line 16

  1. <?php
  2. namespace App\Modules\TicketCart\Entity;
  3. use App\Admin\Modules\Voucher\Entity\VoucherPackage;
  4. use App\Admin\Modules\Voucher\Entity\VoucherPackageVoucher;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Table(name="ticket_order_ticket", indexes={@ORM\Index(columns={"name"}), @ORM\Index(columns={"price"}), @ORM\Index(columns={"total_price"})})
  11.  * @ORM\Entity
  12.  */
  13. class TicketOrderTicket
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Id
  19.      * @ORM\Column(type="bigint", options={"unsigned"=true}))
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.     
  24.     /**
  25.      * @var \App\Modules\TicketCart\Entity\TicketOrder
  26.      *
  27.      * @ORM\ManyToOne(targetEntity="App\Modules\TicketCart\Entity\TicketOrder", inversedBy="tickets")
  28.      * @ORM\JoinColumns({
  29.      *   @ORM\JoinColumn(name="id_ticket_order", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  30.      * })
  31.      */
  32.     private $order;
  33.     
  34.     /**
  35.      * @var \App\Admin\Modules\Voucher\Entity\VoucherPackage
  36.      *
  37.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\Voucher\Entity\VoucherPackage")
  38.      * @ORM\JoinColumns({
  39.      *   @ORM\JoinColumn(name="id_voucher_package", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  40.      * })
  41.      */
  42.     private $package;
  43.     
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="name", type="string", length=255, nullable=true, options={"collation"="utf8_unicode_ci"})
  48.      */
  49.     private $name;
  50.     /**
  51.      * @var string
  52.      *
  53.      * @ORM\Column(name="price", type="decimal", precision=14, scale=2, nullable=false)
  54.      */
  55.     private $price;
  56.     /**
  57.      * @var int
  58.      *
  59.      * @ORM\Column(name="quantity", type="integer", nullable=false)
  60.      */
  61.     private $quantity;
  62.     /**
  63.      * @var string
  64.      *
  65.      * @ORM\Column(name="total_price", type="decimal", precision=14, scale=2, nullable=false)
  66.      */
  67.     private $totalPrice;
  68.     
  69.     /**
  70.      * @var string
  71.      *
  72.      * @ORM\Column(name="data", type="text", nullable=true)
  73.      */
  74.     private $data;
  75.     
  76.     /**
  77.      * @var \App\Admin\Modules\Voucher\Entity\VoucherPackageVoucher
  78.      *
  79.      * @ORM\ManyToMany(targetEntity="App\Admin\Modules\Voucher\Entity\VoucherPackageVoucher", inversedBy="ticket")
  80.      * @ORM\JoinTable(name="ticket_order_ticket_package_voucher",
  81.      *      joinColumns={@ORM\JoinColumn(name="id_ticket_order_ticket", referencedColumnName="id", onDelete="CASCADE")},
  82.      *      inverseJoinColumns={@ORM\JoinColumn(name="id_voucher_package_voucher", referencedColumnName="id", onDelete="CASCADE")}
  83.      *    )
  84.      **/
  85.     private $vouchers;
  86.     public function __construct()
  87.     {
  88.         $this->vouchers = new ArrayCollection();
  89.     }
  90.     public function getId(): ?string
  91.     {
  92.         return $this->id;
  93.     }
  94.     public function getName(): ?string
  95.     {
  96.         return $this->name;
  97.     }
  98.     public function setName(?string $name): self
  99.     {
  100.         $this->name $name;
  101.         return $this;
  102.     }
  103.     public function getPrice(): ?string
  104.     {
  105.         return $this->price;
  106.     }
  107.     public function setPrice(string $price): self
  108.     {
  109.         $this->price $price;
  110.         return $this;
  111.     }
  112.     public function getQuantity(): ?int
  113.     {
  114.         return $this->quantity;
  115.     }
  116.     public function setQuantity(int $quantity): self
  117.     {
  118.         $this->quantity $quantity;
  119.         return $this;
  120.     }
  121.     public function getTotalPrice(): ?string
  122.     {
  123.         return $this->totalPrice;
  124.     }
  125.     public function setTotalPrice(string $totalPrice): self
  126.     {
  127.         $this->totalPrice $totalPrice;
  128.         return $this;
  129.     }
  130.     public function getOrder(): ?TicketOrder
  131.     {
  132.         return $this->order;
  133.     }
  134.     public function setOrder(?TicketOrder $order): self
  135.     {
  136.         $this->order $order;
  137.         return $this;
  138.     }
  139.     public function getPackage(): ?VoucherPackage
  140.     {
  141.         return $this->package;
  142.     }
  143.     public function setPackage(?VoucherPackage $package): self
  144.     {
  145.         $this->package $package;
  146.         return $this;
  147.     }
  148.     /**
  149.      * @return Collection<int, VoucherPackageVoucher>
  150.      */
  151.     public function getVouchers(): Collection
  152.     {
  153.         return $this->vouchers;
  154.     }
  155.     public function addVoucher(VoucherPackageVoucher $voucher): self
  156.     {
  157.         if (!$this->vouchers->contains($voucher)) {
  158.             $this->vouchers->add($voucher);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeVoucher(VoucherPackageVoucher $voucher): self
  163.     {
  164.         $this->vouchers->removeElement($voucher);
  165.         return $this;
  166.     }
  167.     public function getData(): ?string
  168.     {
  169.         return $this->data;
  170.     }
  171.     public function setData(?string $data): self
  172.     {
  173.         $this->data $data;
  174.         return $this;
  175.     }
  176. }