<?php
declare(strict_types=1);
namespace App\Entity;
use App\Repository\ConventionCollectiveRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* ConventionCollective.
*
* @ORM\Table(name="ConventionCollective")
*
* @ORM\Entity(repositoryClass=ConventionCollectiveRepository::class)
*/
class ConventionCollective
{
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
private ?int $id = null;
/**
* @ORM\Column(name="nom", type="string", length=255)
*/
private string $nom;
/**
* @ORM\OneToMany(targetEntity="Structure", mappedBy="conventionCollective")
*/
private Collection $structures;
public function __construct()
{
$this->structures = new ArrayCollection();
}
public function __toString(): string
{
return $this->nom;
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): string
{
return $this->nom;
}
public function setNom(string $nom): static
{
$this->nom = $nom;
return $this;
}
/**
* @return Collection<int, Structure>
*/
public function getStructures(): Collection
{
return $this->structures;
}
public function addStructure(Structure $structure): static
{
if (!$this->structures->contains($structure)) {
$this->structures->add($structure);
$structure->setConventionCollective($this);
}
return $this;
}
public function removeStructure(Structure $structure): static
{
if ($this->structures->removeElement($structure)) {
if ($structure->getConventionCollective() === $this) {
$structure->setConventionCollective(null);
}
}
return $this;
}
}