src/Entity/Order.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrderRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassOrderRepository::class)]
  11. #[ORM\Table(name'`order`')]
  12. class Order
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\Column(type"string"uniquetrue)]
  16.     #[ORM\GeneratedValue(strategy"CUSTOM")]
  17.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  18.     #[Groups(['orderJsonData'])]
  19.     private $id;
  20.     #[ORM\Column(type'text'nullabletrue)]
  21.     private $jsonData;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     #[Groups(['orderJsonData'])]
  24.     private ?string $stripePaymentIntent null;
  25.     #[ORM\ManyToOne(inversedBy'orders')]
  26.     #[ORM\JoinColumn(nullabletrue)]
  27.     #[Groups(['orderJsonData'])]
  28.     private ?TicketOwner $ticketOwner null;
  29.     #[ORM\OneToMany(mappedBy'relatedOrder'targetEntityTicketCart::class, cascade: ['persist'])]
  30.     #[ORM\OrderBy(["ticket" => "ASC"])]
  31.     #[Groups(['orderJsonData'])]
  32.     private Collection $ticketCarts;
  33.     #[ORM\Column]
  34.     private ?DateTimeImmutable $createdAt null;
  35.     #[ORM\Column(nullabletrue)]
  36.     #[Groups(['orderJsonData'])]
  37.     private ?DateTimeImmutable $payedAt null;
  38.     #[ORM\ManyToOne(inversedBy'orders')]
  39.     #[Groups(['orderJsonData'])]
  40.     private ?Event $relatedEvent null;
  41.     #[ORM\OneToMany(mappedBy'fromOrder'targetEntityMoveHistory::class)]
  42.     private Collection $moveHistories;
  43.     public function __construct()
  44.     {
  45.         $this->ticketCarts = new ArrayCollection();
  46.         $this->createdAt = new DateTimeImmutable('now');
  47.         $this->moveHistories = new ArrayCollection();
  48.     }
  49.     /**
  50.      * @return mixed
  51.      */
  52.     public function getId()
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getJsonData(): ?string
  57.     {
  58.         return $this->jsonData;
  59.     }
  60.     public function setJsonData(string $jsonData): self
  61.     {
  62.         $this->jsonData $jsonData;
  63.         return $this;
  64.     }
  65.     public function getStripePaymentIntent(): ?string
  66.     {
  67.         return $this->stripePaymentIntent;
  68.     }
  69.     public function setStripePaymentIntent(string $stripePaymentIntent): self
  70.     {
  71.         $this->stripePaymentIntent $stripePaymentIntent;
  72.         return $this;
  73.     }
  74.     public function getTicketOwner(): ?TicketOwner
  75.     {
  76.         return $this->ticketOwner;
  77.     }
  78.     public function setTicketOwner(?TicketOwner $ticketOwner): self
  79.     {
  80.         $this->ticketOwner $ticketOwner;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, TicketCart>
  85.      */
  86.     public function getTicketCarts(): Collection
  87.     {
  88.         return $this->ticketCarts;
  89.     }
  90.     public function addTicketCart(TicketCart $ticketCart): self
  91.     {
  92.         if (!$this->ticketCarts->contains($ticketCart)) {
  93.             $this->ticketCarts->add($ticketCart);
  94.             $ticketCart->setRelatedOrder($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeTicketCart(TicketCart $ticketCart): self
  99.     {
  100.         if ($this->ticketCarts->removeElement($ticketCart)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($ticketCart->getRelatedOrder() === $this) {
  103.                 $ticketCart->setRelatedOrder(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     public function getCreatedAt(): ?DateTimeImmutable
  109.     {
  110.         return $this->createdAt;
  111.     }
  112.     public function setCreatedAt(DateTimeImmutable $createdAt): self
  113.     {
  114.         $this->createdAt $createdAt;
  115.         return $this;
  116.     }
  117.     public function getPayedAt(): ?DateTimeImmutable
  118.     {
  119.         return $this->payedAt;
  120.     }
  121.     public function setPayedAt(?DateTimeImmutable $payedAt): self
  122.     {
  123.         $this->payedAt $payedAt;
  124.         return $this;
  125.     }
  126.     public function getRelatedEvent(): ?Event
  127.     {
  128.         return $this->relatedEvent;
  129.     }
  130.     public function setRelatedEvent(?Event $relatedEvent): self
  131.     {
  132.         $this->relatedEvent $relatedEvent;
  133.         return $this;
  134.     }
  135.     /**
  136.      * @return Collection<int, MoveHistory>
  137.      */
  138.     public function getMoveHistories(): Collection
  139.     {
  140.         return $this->moveHistories;
  141.     }
  142.     public function addMoveHistory(MoveHistory $moveHistory): self
  143.     {
  144.         if (!$this->moveHistories->contains($moveHistory)) {
  145.             $this->moveHistories->add($moveHistory);
  146.             $moveHistory->setFromOrder($this);
  147.         }
  148.         return $this;
  149.     }
  150.     public function removeMoveHistory(MoveHistory $moveHistory): self
  151.     {
  152.         if ($this->moveHistories->removeElement($moveHistory)) {
  153.             // set the owning side to null (unless already changed)
  154.             if ($moveHistory->getFromOrder() === $this) {
  155.                 $moveHistory->setFromOrder(null);
  156.             }
  157.         }
  158.         return $this;
  159.     }
  160. }