src/Flexy/ShopBundle/Entity/Product/AttributValue.php line 18
<?phpnamespace App\Flexy\ShopBundle\Entity\Product;use ApiPlatform\Core\Annotation\ApiResource;use App\Flexy\ShopBundle\Repository\Product\AttributValueRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ApiResource(normalizationContext: ['groups' => ['read']],denormalizationContext: ['groups' => ['write']],)]#[ORM\Entity(repositoryClass: AttributValueRepository::class)]class AttributValue implements \Stringable{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private $id;#[ORM\Column(type: 'text', nullable: true)]private ?string $description = null;#[ORM\Column(type: 'datetime_immutable', nullable: true)]private ?\DateTimeImmutable $createdAt = null;#[ORM\ManyToOne(targetEntity: Attribut::class, inversedBy: 'attributValues')]#[Groups(['read', 'readDeep'])]private ?\App\Flexy\ShopBundle\Entity\Product\Attribut $attribut = null;#[ORM\Column(type: 'string', length: 255,nullable:true)]private ?string $value = null;#[ORM\ManyToOne(targetEntity: Product::class, inversedBy: 'attributValues', cascade: ['persist'])]private ?\App\Flexy\ShopBundle\Entity\Product\Product $product = null;#[ORM\Column(type: 'float', nullable: true)]#[Groups(['read', 'readDeep'])]private ?float $price = null;#[ORM\Column(type: 'integer', nullable: true)]private ?int $quantity = null;#[ORM\ManyToMany(targetEntity: ProductVariant::class, mappedBy: 'attributeValues')]private \Doctrine\Common\Collections\Collection|array $productVariants;public function __construct(){$this->productVariants = new ArrayCollection();}public function __toString(): string{return $this->attribut ." : ". $this->value;}public function getId(): ?int{return $this->id;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(?\DateTimeImmutable $createdAt): self{$this->createdAt = $createdAt;return $this;}public function getAttribut(): ?Attribut{return $this->attribut;}public function setAttribut(?Attribut $attribut): self{$this->attribut = $attribut;return $this;}public function getValue(): ?string{return $this->value;}public function setValue(string $value): self{$this->value = $value;return $this;}public function getProduct(): ?Product{return $this->product;}public function setProduct(?Product $product): self{$this->product = $product;return $this;}public function getPrice(): ?float{return $this->price;}public function setPrice(?float $price): self{$this->price = $price;return $this;}public function getQuantity(): ?int{return $this->quantity;}public function setQuantity(?int $quantity): self{$this->quantity = $quantity;return $this;}/*** @return Collection|ProductVariant[]*/public function getProductVariants(): Collection{return $this->productVariants;}public function addProductVariant(ProductVariant $productVariant): self{if (!$this->productVariants->contains($productVariant)) {$this->productVariants[] = $productVariant;$productVariant->addAttributeValue($this);}return $this;}public function removeProductVariant(ProductVariant $productVariant): self{if ($this->productVariants->removeElement($productVariant)) {$productVariant->removeAttributeValue($this);}return $this;}#[Groups(['read', 'readDeep'])]public function getAttributName(){return $this->getAttribut()->getName();}}