<?phpnamespace App\Entity;use App\Repository\OrderRepository;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: OrderRepository::class)]#[ORM\Table(name: '`order`')]class Order{ #[ORM\Id] #[ORM\Column(type: "string", unique: true)] #[ORM\GeneratedValue(strategy: "CUSTOM")] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] #[Groups(['orderJsonData'])] private $id; #[ORM\Column(type: 'text', nullable: true)] private $jsonData; #[ORM\Column(length: 255, nullable: true)] #[Groups(['orderJsonData'])] private ?string $stripePaymentIntent = null; #[ORM\ManyToOne(inversedBy: 'orders')] #[ORM\JoinColumn(nullable: true)] #[Groups(['orderJsonData'])] private ?TicketOwner $ticketOwner = null; #[ORM\OneToMany(mappedBy: 'relatedOrder', targetEntity: TicketCart::class, cascade: ['persist'])] #[ORM\OrderBy(["ticket" => "ASC"])] #[Groups(['orderJsonData'])] private Collection $ticketCarts; #[ORM\Column] private ?DateTimeImmutable $createdAt = null; #[ORM\Column(nullable: true)] #[Groups(['orderJsonData'])] private ?DateTimeImmutable $payedAt = null; #[ORM\ManyToOne(inversedBy: 'orders')] #[Groups(['orderJsonData'])] private ?Event $relatedEvent = null; #[ORM\OneToMany(mappedBy: 'fromOrder', targetEntity: MoveHistory::class)] private Collection $moveHistories; public function __construct() { $this->ticketCarts = new ArrayCollection(); $this->createdAt = new DateTimeImmutable('now'); $this->moveHistories = new ArrayCollection(); } /** * @return mixed */ public function getId() { return $this->id; } public function getJsonData(): ?string { return $this->jsonData; } public function setJsonData(string $jsonData): self { $this->jsonData = $jsonData; return $this; } public function getStripePaymentIntent(): ?string { return $this->stripePaymentIntent; } public function setStripePaymentIntent(string $stripePaymentIntent): self { $this->stripePaymentIntent = $stripePaymentIntent; return $this; } public function getTicketOwner(): ?TicketOwner { return $this->ticketOwner; } public function setTicketOwner(?TicketOwner $ticketOwner): self { $this->ticketOwner = $ticketOwner; return $this; } /** * @return Collection<int, TicketCart> */ public function getTicketCarts(): Collection { return $this->ticketCarts; } public function addTicketCart(TicketCart $ticketCart): self { if (!$this->ticketCarts->contains($ticketCart)) { $this->ticketCarts->add($ticketCart); $ticketCart->setRelatedOrder($this); } return $this; } public function removeTicketCart(TicketCart $ticketCart): self { if ($this->ticketCarts->removeElement($ticketCart)) { // set the owning side to null (unless already changed) if ($ticketCart->getRelatedOrder() === $this) { $ticketCart->setRelatedOrder(null); } } return $this; } public function getCreatedAt(): ?DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getPayedAt(): ?DateTimeImmutable { return $this->payedAt; } public function setPayedAt(?DateTimeImmutable $payedAt): self { $this->payedAt = $payedAt; return $this; } public function getRelatedEvent(): ?Event { return $this->relatedEvent; } public function setRelatedEvent(?Event $relatedEvent): self { $this->relatedEvent = $relatedEvent; return $this; } /** * @return Collection<int, MoveHistory> */ public function getMoveHistories(): Collection { return $this->moveHistories; } public function addMoveHistory(MoveHistory $moveHistory): self { if (!$this->moveHistories->contains($moveHistory)) { $this->moveHistories->add($moveHistory); $moveHistory->setFromOrder($this); } return $this; } public function removeMoveHistory(MoveHistory $moveHistory): self { if ($this->moveHistories->removeElement($moveHistory)) { // set the owning side to null (unless already changed) if ($moveHistory->getFromOrder() === $this) { $moveHistory->setFromOrder(null); } } return $this; }}