<?php
namespace App\Entity;
use App\Repository\DeclinationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DeclinationRepository::class)
*/
class Declination
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity=Produit::class, inversedBy="declinations")
*/
private $Produits;
/**
* @ORM\OneToMany(targetEntity=ValueDeclination::class, mappedBy="declination")
* @ORM\OrderBy({"name" = "ASC"})
*/
private $valueDeclinations;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $position;
public function __construct()
{
$this->Produits = new ArrayCollection();
$this->valueDeclinations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Produit[]
*/
public function getProduits(): Collection
{
return $this->Produits;
}
public function addProduit(Produit $produit): self
{
if (!$this->Produits->contains($produit)) {
$this->Produits[] = $produit;
}
return $this;
}
public function removeProduit(Produit $produit): self
{
$this->Produits->removeElement($produit);
return $this;
}
/**
* @return Collection|ValueDeclination[]
*/
public function getValueDeclinations(): Collection
{
return $this->valueDeclinations;
}
public function addValueDeclination(ValueDeclination $valueDeclination): self
{
if (!$this->valueDeclinations->contains($valueDeclination)) {
$this->valueDeclinations[] = $valueDeclination;
$valueDeclination->setDeclination($this);
}
return $this;
}
public function removeValueDeclination(ValueDeclination $valueDeclination): self
{
if ($this->valueDeclinations->removeElement($valueDeclination)) {
// set the owning side to null (unless already changed)
if ($valueDeclination->getDeclination() === $this) {
$valueDeclination->setDeclination(null);
}
}
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
}