src/Entity/OrderItem.php line 9
<?php
namespace App\Entity;
use App\Repository\OrderItemRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OrderItemRepository::class)]
class OrderItem
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?int $quantity = null;
#[ORM\ManyToOne(inversedBy: 'items')]
#[ORM\JoinColumn(nullable: false)]
private ?Order $relatedOrder = null;
#[ORM\ManyToOne(inversedBy: 'orderItems')]
#[ORM\JoinColumn(nullable: false)]
private ?ProductVariant $productVariant = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(nullable: true)]
private ?float $price = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
public function getId(): ?int
{
return $this->id;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(int $quantity): static
{
$this->quantity = $quantity;
return $this;
}
public function getRelatedOrder(): ?Order
{
return $this->relatedOrder;
}
public function setRelatedOrder(?Order $relatedOrder): static
{
$this->relatedOrder = $relatedOrder;
return $this;
}
public function getProductVariant(): ?ProductVariant
{
return $this->productVariant;
}
public function setProductVariant(?ProductVariant $productVariant): static
{
$this->productVariant = $productVariant;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): static
{
$this->image = $image;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): static
{
$this->price = $price;
return $this;
}
public function __toString(): string
{
return $this->productVariant->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
}