<?php
namespace App\Entity;
use App\Repository\ParamColorRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParamColorRepository::class)]
class ParamColor
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $colorCode = null;
#[ORM\Column(length: 255)]
private ?string $colorName = null;
#[ORM\OneToMany(mappedBy: 'paramColor', targetEntity: ProduitVariant::class)]
private Collection $produitVariants;
public function __construct()
{
$this->produitVariants = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getColorCode(): ?string
{
return $this->colorCode;
}
public function setColorCode(?string $colorCode): static
{
$this->colorCode = $colorCode;
return $this;
}
public function getColorName(): ?string
{
return $this->colorName;
}
public function setColorName(string $colorName): static
{
$this->colorName = $colorName;
return $this;
}
/**
* @return Collection<int, ProduitVariant>
*/
public function getProduitVariants(): Collection
{
return $this->produitVariants;
}
public function addProduitVariant(ProduitVariant $produitVariant): static
{
if (!$this->produitVariants->contains($produitVariant)) {
$this->produitVariants->add($produitVariant);
$produitVariant->setParamColor($this);
}
return $this;
}
public function removeProduitVariant(ProduitVariant $produitVariant): static
{
if ($this->produitVariants->removeElement($produitVariant)) {
// set the owning side to null (unless already changed)
if ($produitVariant->getParamColor() === $this) {
$produitVariant->setParamColor(null);
}
}
return $this;
}
}