<?php
namespace App\Entity;
use App\Repository\CartItemRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CartItemRepository::class)]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn('type', 'string')]
#[ORM\DiscriminatorMap([
'cart_item' => CartItem::class,
'purchase' => CartItemPurchase::class,
'rental' => CartItemRental::class,
'donation' => CartItemDonation::class,
'lesson' => CartItemLesson::class,
'discount' => CartItemDiscount::class,
'family_discount' => CartItemFamilyDiscout::class,
'entry_fee' => CartItemEntryFees::class,
'debt' => CartItemDebt::class,
])]
class CartItem
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'float', nullable: true)]
private $price;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $name;
#[ORM\ManyToOne(targetEntity: Cart::class, inversedBy: 'items')]
#[ORM\JoinColumn(nullable: false)]
private $cart;
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 getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getCart(): ?Cart
{
return $this->cart;
}
public function setCart(?Cart $cart): self
{
$this->cart = $cart;
return $this;
}
public function __toString(): string
{
return $this->getName();
}
}