src/Entity/CartItem.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CartItemRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassCartItemRepository::class)]
  6. #[ORM\InheritanceType('SINGLE_TABLE')]
  7. #[ORM\DiscriminatorColumn('type''string')]
  8. #[ORM\DiscriminatorMap([
  9.     'cart_item'       => CartItem::class,
  10.     'purchase'        => CartItemPurchase::class,
  11.     'rental'          => CartItemRental::class,
  12.     'donation'        => CartItemDonation::class,
  13.     'lesson'          => CartItemLesson::class,
  14.     'discount'        => CartItemDiscount::class,
  15.     'family_discount' => CartItemFamilyDiscout::class,
  16.     'entry_fee'       => CartItemEntryFees::class,
  17.     'debt'            => CartItemDebt::class,
  18. ])]
  19. class CartItem
  20. {
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue]
  23.     #[ORM\Column(type'integer')]
  24.     private $id;
  25.     #[ORM\Column(type'float'nullabletrue)]
  26.     private $price;
  27.     #[ORM\Column(type'string'length255nullabletrue)]
  28.     private $name;
  29.     #[ORM\ManyToOne(targetEntityCart::class, inversedBy'items')]
  30.     #[ORM\JoinColumn(nullablefalse)]
  31.     private $cart;
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getPrice(): ?float
  37.     {
  38.         return $this->price;
  39.     }
  40.     public function setPrice(?float $price): self
  41.     {
  42.         $this->price $price;
  43.         return $this;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(?string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     public function getCart(): ?Cart
  55.     {
  56.         return $this->cart;
  57.     }
  58.     public function setCart(?Cart $cart): self
  59.     {
  60.         $this->cart $cart;
  61.         return $this;
  62.     }
  63.     public function __toString(): string
  64.     {
  65.         return $this->getName();
  66.     }
  67. }