src/Entity/Ticket.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity(repositoryClass="App\Repository\TicketRepository")
  8. */
  9. class Ticket
  10. {
  11. /**
  12. * @ORM\Id()
  13. * @ORM\GeneratedValue()
  14. * @ORM\Column(type="integer")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(type="string", length=100)
  19. */
  20. private $nameFr;
  21. /**
  22. * @ORM\Column(type="string", length=100)
  23. */
  24. private $nameEn;
  25. /**
  26. * @ORM\Column(type="string", length=255)
  27. */
  28. private $descriptionFr;
  29. /**
  30. * @ORM\Column(type="string", length=255)
  31. */
  32. private $descriptionEn;
  33. /**
  34. * @ORM\Column(type="integer")
  35. */
  36. private $price;
  37. /**
  38. * @ORM\Column(type="integer")
  39. */
  40. private $monthValidity;
  41. /**
  42. * @ORM\Column(type="integer")
  43. */
  44. private $nbOfClass;
  45. /**
  46. * @ORM\OneToMany(targetEntity="App\Entity\TicketOrder", mappedBy="ticket")
  47. */
  48. private $ticketOrders;
  49. /**
  50. * @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="tickets")
  51. */
  52. private $category;
  53. public function __construct()
  54. {
  55. $this->ticketOrders = new ArrayCollection();
  56. }
  57. public function getId(): ?int
  58. {
  59. return $this->id;
  60. }
  61. public function getNameFr(): ?string
  62. {
  63. return $this->nameFr;
  64. }
  65. public function setNameFr(string $nameFr): self
  66. {
  67. $this->nameFr = $nameFr;
  68. return $this;
  69. }
  70. public function getNameEn(): ?string
  71. {
  72. return $this->nameEn;
  73. }
  74. public function setNameEn(string $nameEn): self
  75. {
  76. $this->nameEn = $nameEn;
  77. return $this;
  78. }
  79. public function getDescriptionFr(): ?string
  80. {
  81. return $this->descriptionFr;
  82. }
  83. public function setDescriptionFr(string $descriptionFr): self
  84. {
  85. $this->descriptionFr = $descriptionFr;
  86. return $this;
  87. }
  88. public function getDescriptionEn(): ?string
  89. {
  90. return $this->descriptionEn;
  91. }
  92. public function setDescriptionEn(string $descriptionEn): self
  93. {
  94. $this->descriptionEn = $descriptionEn;
  95. return $this;
  96. }
  97. public function getPrice(): ?int
  98. {
  99. return $this->price;
  100. }
  101. public function setPrice(int $price): self
  102. {
  103. $this->price = $price;
  104. return $this;
  105. }
  106. public function getMonthValidity(): ?int
  107. {
  108. return $this->monthValidity;
  109. }
  110. public function setMonthValidity(int $monthValidity): self
  111. {
  112. $this->monthValidity = $monthValidity;
  113. return $this;
  114. }
  115. public function getNbOfClass(): ?int
  116. {
  117. return $this->nbOfClass;
  118. }
  119. public function setNbOfClass(int $nbOfClass): self
  120. {
  121. $this->nbOfClass = $nbOfClass;
  122. return $this;
  123. }
  124. /**
  125. * @return Collection|TicketOrder[]
  126. */
  127. public function getTicketOrders(): Collection
  128. {
  129. return $this->ticketOrders;
  130. }
  131. public function addTicketOrder(TicketOrder $ticketOrder): self
  132. {
  133. if (!$this->ticketOrders->contains($ticketOrder)) {
  134. $this->ticketOrders[] = $ticketOrder;
  135. $ticketOrder->setTicket($this);
  136. }
  137. return $this;
  138. }
  139. public function removeTicketOrder(TicketOrder $ticketOrder): self
  140. {
  141. if ($this->ticketOrders->contains($ticketOrder)) {
  142. $this->ticketOrders->removeElement($ticketOrder);
  143. // set the owning side to null (unless already changed)
  144. if ($ticketOrder->getTicket() === $this) {
  145. $ticketOrder->setTicket(null);
  146. }
  147. }
  148. return $this;
  149. }
  150. public function getCategory(): ?Category
  151. {
  152. return $this->category;
  153. }
  154. public function setCategory(?Category $category): self
  155. {
  156. $this->category = $category;
  157. return $this;
  158. }
  159. public function __toString()
  160. {
  161. return $this->getNameEn();
  162. }
  163. }