src/Entity/Tickets.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\MainTranslationTrait;
  4. use App\Entity\Translation\TicketsTranslation;
  5. use App\Repository\TicketsRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Gedmo\Translatable\Translatable;
  11. #[ORM\Table(name'tickets')]
  12. #[ORM\Entity(repositoryClassTicketsRepository::class)]
  13. #[Gedmo\TranslationEntity(class: TicketsTranslation::class)]
  14. class Tickets implements Translatable
  15. {
  16.     use MainTranslationTrait;
  17.     const TRANSLATION_ENTITY TicketsTranslation::class;
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(type'integer'nullabletrue)]
  23.     private ?int $ticketTypeId null;
  24.     #[ORM\Column(type'string'nullabletrue)]
  25.     #[Gedmo\Translatable]
  26.     private ?string $title null;
  27.     #[ORM\Column(type'string'nullabletrue)]
  28.     #[Gedmo\Translatable]
  29.     private ? string $description null;
  30.     #[ORM\Column(type'float'nullabletrue)]
  31.     private ?float $price null;
  32.     #[ORM\Column(type'float'nullabletrue)]
  33.     private ?float $discountedPrice null;
  34.     #[ORM\Column(type'boolean'nullabletrue)]
  35.     private ?bool $isFree null;
  36.     #[ORM\Column(type'boolean'nullabletrueoptions: ['default' => true])]
  37.     private ?bool $isActive true;
  38.     #[ORM\Column(type'boolean'nullabletrueoptions: ['default' => false])]
  39.     private ?bool $isCharity  false;
  40.     #[ORM\Column(type'boolean'nullabletrue)]
  41.     private ?bool $showHomePage null;
  42.     #[ORM\OneToMany(mappedBy'ticket'targetEntityBasket::class, cascade: ['persist''remove'])]
  43.     private Collection $basket;
  44.     #[ORM\OneToMany(mappedBy'ticket'targetEntityOrderItem::class, cascade: ['persist''remove'])]
  45.     private Collection $orderItem;
  46.     #[ORM\Column(type'string',length160nullabletrue)]
  47.     #[Gedmo\Translatable]
  48.     private ?string $metaKeywords null;
  49.     #[ORM\Column(type'string',length160nullabletrue)]
  50.     #[Gedmo\Translatable]
  51.     private ?string $metaDescription null;
  52.     #[ORM\Column(type'integer'nullabletrue)]
  53.     private ?int $position null;
  54.     public function __construct()
  55.     {
  56.         $this->basket = new ArrayCollection();
  57.         $this->orderItem = new ArrayCollection();
  58.     }
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function __toString(): string
  64.     {
  65.         return $this->title ?? "";
  66.     }
  67.     public function getTicketTypeId(): ?int
  68.     {
  69.         return $this->ticketTypeId;
  70.     }
  71.     public function setTicketTypeId(?int $ticketTypeId): void
  72.     {
  73.         $this->ticketTypeId $ticketTypeId;
  74.     }
  75.     public function getTitle(): ?string
  76.     {
  77.         return $this->title;
  78.     }
  79.     public function setTitle(?string $title): static
  80.     {
  81.         $this->title $title;
  82.         return $this;
  83.     }
  84.     public function getDescription(): ?string
  85.     {
  86.         return $this->description;
  87.     }
  88.     public function setDescription(?string $description): static
  89.     {
  90.         $this->description $description;
  91.         return $this;
  92.     }
  93.     public function getPrice(): ?float
  94.     {
  95.         return $this->price;
  96.     }
  97.     public function setPrice(?float $price): static
  98.     {
  99.         $this->price $price;
  100.         return $this;
  101.     }
  102.     public function getDiscountedPrice(): ?float
  103.     {
  104.         return $this->discountedPrice;
  105.     }
  106.     public function setDiscountedPrice(?float $discountedPrice): static
  107.     {
  108.         $this->discountedPrice $discountedPrice;
  109.         return $this;
  110.     }
  111.     public function getIsFree(): ?bool
  112.     {
  113.         return $this->isFree;
  114.     }
  115.     public function setIsFree(?bool $isFree): void
  116.     {
  117.         $this->isFree $isFree;
  118.     }
  119.     public function isShowHomePage(): ?bool
  120.     {
  121.         return $this->showHomePage;
  122.     }
  123.     public function setShowHomePage(?bool $showHomePage): static
  124.     {
  125.         $this->showHomePage $showHomePage;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, Basket>
  130.      */
  131.     public function getBasket(): Collection
  132.     {
  133.         return $this->basket;
  134.     }
  135.     public function addBasket(Basket $basket): static
  136.     {
  137.         if (!$this->basket->contains($basket)) {
  138.             $this->basket->add($basket);
  139.             $basket->setTicket($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeBasket(Basket $basket): static
  144.     {
  145.         if ($this->basket->removeElement($basket)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($basket->getTicket() === $this) {
  148.                 $basket->setTicket(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153.     public function getIsActive(): ?bool
  154.     {
  155.         return $this->isActive;
  156.     }
  157.     public function setIsActive(?bool $isActive): void
  158.     {
  159.         $this->isActive $isActive;
  160.     }
  161.     public function isIsActive(): ?bool
  162.     {
  163.         return $this->isActive;
  164.     }
  165.     /**
  166.      * @return Collection<int, OrderItem>
  167.      */
  168.     public function getOrderItem(): Collection
  169.     {
  170.         return $this->orderItem;
  171.     }
  172.     public function addOrderItem(OrderItem $orderItem): static
  173.     {
  174.         if (!$this->orderItem->contains($orderItem)) {
  175.             $this->orderItem->add($orderItem);
  176.             $orderItem->setTicket($this);
  177.         }
  178.         return $this;
  179.     }
  180.     public function removeOrderItem(OrderItem $orderItem): static
  181.     {
  182.         if ($this->orderItem->removeElement($orderItem)) {
  183.             // set the owning side to null (unless already changed)
  184.             if ($orderItem->getTicket() === $this) {
  185.                 $orderItem->setTicket(null);
  186.             }
  187.         }
  188.         return $this;
  189.     }
  190.     public function getMetaKeywords(): ?string
  191.     {
  192.         return $this->metaKeywords;
  193.     }
  194.     public function setMetaKeywords(?string $metaKeywords): void
  195.     {
  196.         $this->metaKeywords $metaKeywords;
  197.     }
  198.     public function getMetaDescription(): ?string
  199.     {
  200.         return $this->metaDescription;
  201.     }
  202.     public function setMetaDescription(?string $metaDescription): void
  203.     {
  204.         $this->metaDescription $metaDescription;
  205.     }
  206.     public function getIsCharity(): ?bool
  207.     {
  208.         return $this->isCharity;
  209.     }
  210.     public function setIsCharity(?bool $isCharity): void
  211.     {
  212.         $this->isCharity $isCharity;
  213.     }
  214.     public function getPosition(): ?int
  215.     {
  216.         return $this->position;
  217.     }
  218.     public function setPosition(?int $position): void
  219.     {
  220.         $this->position $position;
  221.     }
  222. }