<?php
namespace App\Entity;
use App\Repository\DeviseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DeviseRepository::class)]
class Devise
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $sigle = null;
#[ORM\OneToMany(mappedBy: 'devise', targetEntity: Projet::class)]
private Collection $projets;
public function __construct()
{
$this->projets = 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;
}
public function getSigle(): ?string
{
return $this->sigle;
}
public function setSigle(string $sigle): self
{
$this->sigle = $sigle;
return $this;
}
/**
* @return Collection<int, Projet>
*/
public function getProjets(): Collection
{
return $this->projets;
}
public function addProjet(Projet $projet): self
{
if (!$this->projets->contains($projet)) {
$this->projets->add($projet);
$projet->setDevise($this);
}
return $this;
}
public function removeProjet(Projet $projet): self
{
if ($this->projets->removeElement($projet)) {
// set the owning side to null (unless already changed)
if ($projet->getDevise() === $this) {
$projet->setDevise(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
}