<?phpnamespace App\Entity;use App\Repository\ProductExtraRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ProductExtraRepository::class)]class ProductExtra{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private ?int $id = null; #[ORM\ManyToOne(targetEntity: Product::class, inversedBy: 'productExtras')] private ?Product $product = null; #[ORM\ManyToOne(targetEntity: Attribute::class, inversedBy: 'productExtras')] private ?Attribute $attribute = null; #[ORM\Column(type: 'decimal', precision: 10, scale: 2, options: ['default' => 0.00])] private ?string $extraPrice = '0.00'; #[ORM\ManyToMany(targetEntity: OrderProduct::class, mappedBy: 'extra')] private Collection $orderProducts; public function __construct() { $this->orderProducts = new ArrayCollection(); } public function __toString(): string { return (string) $this->id . " "; } public function getId(): ?int { return $this->id; } public function getProduct(): ?Product { return $this->product; } public function setProduct(?Product $product): self { $this->product = $product; return $this; } public function getAttribute(): ?Attribute { return $this->attribute; } public function setAttribute(?Attribute $attribute): self { $this->attribute = $attribute; return $this; } public function getAttributeName(): ?string { return $this->attribute?->getName(); } public function getExtraPrice(): ?string { return $this->extraPrice; } public function setExtraPrice(?string $extraPrice): self { $this->extraPrice = $extraPrice; return $this; } /** * @return Collection<int, OrderProduct> */ public function getOrderProducts(): Collection { return $this->orderProducts; } public function addOrderProduct(OrderProduct $orderProduct): self { if (!$this->orderProducts->contains($orderProduct)) { $this->orderProducts[] = $orderProduct; $orderProduct->addExtra($this); } return $this; } public function removeOrderProduct(OrderProduct $orderProduct): self { if ($this->orderProducts->removeElement($orderProduct)) { $orderProduct->removeExtra($this); } return $this; }}