Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
proc
/
self
/
root
/
proc
/
212
/
root
/
proc
/
212
/
task
/
212
/
root
/
proc
/
70528
/
task
/
70528
/
cwd
/
src
/
Entity
/
//proc/self/root/proc/212/root/proc/212/task/212/root/proc/70528/task/70528/cwd/src/Entity/Cart.php
<?php namespace App\Entity; use App\Repository\CartRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass=CartRepository::class) */ class Cart { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="float", nullable=true) */ private $price; /** * @ORM\Column(type="datetime") */ private $expiresAt; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="carts") */ private $user; /** * @ORM\Column(type="string", length=255) */ private $payementStatus; /** * @ORM\ManyToMany(targetEntity=CartItem::class) */ private $items; /** * @ORM\Column(type="string", length=512, nullable=true) */ private $sessionToken; /** * @ORM\OneToOne(targetEntity=Command::class, mappedBy="cart", cascade={"persist", "remove"}) */ private $command; /** * @ORM\Column(type="string", length=255) */ private $step; private const DEFAULT_STEP = "cart"; public function __construct() { $this->payementStatus = "to_be_started"; $this->expiresAt = new \DateTime("+1 year"); $this->items = new ArrayCollection(); $this->price = 0; $this->step = self::DEFAULT_STEP; } public function getId(): ?int { return $this->id; } public function getPrice(): ?float { return $this->price; } public function setPrice(?float $price): self { $this->price = $price; return $this; } public function getExpiresAt(): ?\DateTimeInterface { return $this->expiresAt; } public function setExpiresAt(\DateTimeInterface $expiresAt): self { $this->expiresAt = $expiresAt; return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getPayementStatus(): ?string { return $this->payementStatus; } public function setPayementStatus(string $payementStatus): self { $this->payementStatus = $payementStatus; return $this; } /** * @return Collection<int, CartItem> */ public function getItems(): Collection { return $this->items; } public function addItem(CartItem $item): self { if (!$this->items->contains($item)) { $this->items[] = $item; } return $this; } public function removeItem(CartItem $item): self { $this->items->removeElement($item); return $this; } public function getSessionToken(): ?string { return $this->sessionToken; } public function setSessionToken(?string $sessionToken): self { $this->sessionToken = $sessionToken; return $this; } public function getCommand(): ?Command { return $this->command; } public function setCommand(Command $command): self { // set the owning side of the relation if necessary if ($command->getCart() !== $this) { $command->setCart($this); } $this->command = $command; return $this; } public function getStep(): ?string { return $this->step; } public function setStep(string $step): self { $this->step = $step; return $this; } }