src/Entity/Ticket.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TicketsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use ApiPlatform\Core\Annotation\ApiResource;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Endroid\QrCode\Builder\Builder;
  10. /**
  11.  * @ORM\Entity(repositoryClass=TicketsRepository::class)
  12.  * @ORM\Table(name="tickets")
  13.  * @ApiResource(attributes={
  14.  *     "normalization_context"={"groups"={"read"}},
  15.  *     "denormalization_context"={"groups"={"write"}}
  16.  * })
  17.  *
  18.  */
  19. class Ticket
  20. {
  21.     /**
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue
  24.      * @ORM\Column(type="integer")
  25.      * 
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      * 
  31.      */
  32.     private $event_name;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $session_name;
  37.     /**
  38.      * @ORM\Column(type="datetime", nullable=true)
  39.      */
  40.     private $session_date;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $ticket_access;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $ticket_sector;
  49.     /**
  50.      * @ORM\Column(type="string", length=255, nullable=true)
  51.      */
  52.     private $ticket_row;
  53.     /**
  54.      * @ORM\Column(type="string", length=255, nullable=true)
  55.      */
  56.     private $ticket_seat;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $ticket_qr;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $value_qr;
  65.     /**
  66.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="tickets")
  67.      * @Groups("read")
  68.      */
  69.     private $user;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      */
  73.     private $status;
  74.     /**
  75.      * @ORM\Column(type="integer")
  76.      */
  77.     private $idTicket;
  78.     /**
  79.      * @ORM\Column(type="string", length=255, nullable=true)
  80.      */
  81.     private $venue_adress;
  82.     /**
  83.      * @ORM\Column(type="string", length=255, nullable=true)
  84.      */
  85.     private $venue_city;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $code;
  90.     public function getId(): ?int
  91.     {
  92.         return $this->id;
  93.     }
  94.     public function getEventName(): ?string
  95.     {
  96.         return $this->event_name;
  97.     }
  98.     public function setEventName(?string $event_name): self
  99.     {
  100.         $this->event_name $event_name;
  101.         return $this;
  102.     }
  103.     public function getSessionName(): ?string
  104.     {
  105.         return $this->session_name;
  106.     }
  107.     public function setSessionName(string $session_name): self
  108.     {
  109.         $this->session_name $session_name;
  110.         return $this;
  111.     }
  112.     public function getSessionDate(): ?\DateTimeInterface
  113.     {
  114.         return $this->session_date;
  115.     }
  116.     public function setSessionDate(?\DateTimeInterface $session_date): self
  117.     {
  118.         $this->session_date $session_date;
  119.         return $this;
  120.     }
  121.     public function getTicketAccess(): ?string
  122.     {
  123.         return $this->ticket_access;
  124.     }
  125.     public function setTicketAccess(?string $ticket_access): self
  126.     {
  127.         $this->ticket_access $ticket_access;
  128.         return $this;
  129.     }
  130.     public function getTicketSector(): ?string
  131.     {
  132.         return $this->ticket_sector;
  133.     }
  134.     public function setTicketSector(?string $ticket_sector): self
  135.     {
  136.         $this->ticket_sector $ticket_sector;
  137.         return $this;
  138.     }
  139.     public function getTicketRow(): ?string
  140.     {
  141.         return $this->ticket_row;
  142.     }
  143.     public function setTicketRow(?string $ticket_row): self
  144.     {
  145.         $this->ticket_row $ticket_row;
  146.         return $this;
  147.     }
  148.     public function getTicketSeat(): ?string
  149.     {
  150.         return $this->ticket_seat;
  151.     }
  152.     public function setTicketSeat(?string $ticket_seat): self
  153.     {
  154.         $this->ticket_seat $ticket_seat;
  155.         return $this;
  156.     }
  157.     public function getTicketQr(): ?string
  158.     {
  159.         return $this->createQR($this->ticket_qr);
  160.     }
  161.     public function setTicketQr(?string $ticket_qr): self
  162.     {
  163.         $this->ticket_qr $ticket_qr;
  164.         return $this;
  165.     }
  166.     public function getValueQr(): ?string
  167.     {
  168.         return $this->value_qr;
  169.     }
  170.     public function setValueQr(?string $value_qr): self
  171.     {
  172.         $this->value_qr $value_qr;
  173.         return $this;
  174.     }
  175.     public function getUser(): ?User
  176.     {
  177.         return $this->user;
  178.     }
  179.     public function setUser(?User $user): self
  180.     {
  181.         $this->user $user;
  182.         return $this;
  183.     }
  184.     public function getStatus(): ?string
  185.     {
  186.         return $this->status;
  187.     }
  188.     public function setStatus(?string $status): self
  189.     {
  190.         $this->status $status;
  191.         return $this;
  192.     }
  193.     public function getIdTicket(): ?int
  194.     {
  195.         return $this->idTicket;
  196.     }
  197.     public function setIdTicket(int $idTicket): self
  198.     {
  199.         $this->idTicket $idTicket;
  200.         return $this;
  201.     }
  202.     public function getVenueAdress(): ?string
  203.     {
  204.         return $this->venue_adress;
  205.     }
  206.     public function setVenueAdress(?string $venue_adress): self
  207.     {
  208.         $this->venue_adress $venue_adress;
  209.         return $this;
  210.     }
  211.     public function getVenueCity(): ?string
  212.     {
  213.         return $this->venue_city;
  214.     }
  215.     public function setVenueCity(?string $venue_city): self
  216.     {
  217.         $this->venue_city $venue_city;
  218.         return $this;
  219.     }
  220.     public function createQR($value): string
  221.     {
  222.         $qr Builder::create()
  223.         ->data($value)       
  224.         ->build();
  225.         return base64_encode($qr->getString());
  226.     }
  227.     /**
  228.      * @return string|null
  229.      */
  230.     public function getCode(): ?string
  231.     {
  232.         return $this->code;
  233.     }
  234.     /**
  235.      * @param string|null $code
  236.      */
  237.     public function setCode(?string $code): void
  238.     {
  239.         $this->code $code;
  240.     }
  241.    
  242.     
  243. }