<?php
namespace App\Entity;
use App\Repository\ChoralesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use App\Traits\TimeStampTraits;
#[ORM\Entity(repositoryClass: ChoralesRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Chorales
{
use TimeStampTraits;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: "Oops! Veuillez renseigner ce champ.")]
private ?string $libelle = null;
#[ORM\Column(length: 25, nullable: true)]
private ?string $abreviation = null;
#[ORM\OneToMany(mappedBy: 'chorale', targetEntity: ChoraleMembres::class, orphanRemoval: true)]
private Collection $choraleMembres;
#[ORM\OneToMany(mappedBy: 'chorale', targetEntity: Entrees::class)]
private Collection $entrees;
#[ORM\OneToMany(mappedBy: 'chorale', targetEntity: AdherentProjets::class)]
private Collection $adherentProjets;
#[ORM\OneToMany(mappedBy: 'chorale', targetEntity: ConfigurationDonReconnaissance::class)]
private Collection $configurationDonReconnaissances;
public function __construct()
{
$this->choraleMembres = new ArrayCollection();
$this->entrees = new ArrayCollection();
$this->adherentProjets = new ArrayCollection();
$this->configurationDonReconnaissances = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): static
{
$this->libelle = $libelle;
return $this;
}
public function getAbreviation(): ?string
{
return $this->abreviation;
}
public function setAbreviation(?string $abreviation): static
{
$this->abreviation = $abreviation;
return $this;
}
/**
* @return Collection<int, ChoraleMembres>
*/
public function getChoraleMembres(): Collection
{
return $this->choraleMembres;
}
public function addChoraleMembre(ChoraleMembres $choraleMembre): static
{
if (!$this->choraleMembres->contains($choraleMembre)) {
$this->choraleMembres->add($choraleMembre);
$choraleMembre->setChorale($this);
}
return $this;
}
public function removeChoraleMembre(ChoraleMembres $choraleMembre): static
{
if ($this->choraleMembres->removeElement($choraleMembre)) {
// set the owning side to null (unless already changed)
if ($choraleMembre->getChorale() === $this) {
$choraleMembre->setChorale(null);
}
}
return $this;
}
/**
* @return Collection<int, Entrees>
*/
public function getEntrees(): Collection
{
return $this->entrees;
}
public function addEntree(Entrees $entree): static
{
if (!$this->entrees->contains($entree)) {
$this->entrees->add($entree);
$entree->setChorale($this);
}
return $this;
}
public function removeEntree(Entrees $entree): static
{
if ($this->entrees->removeElement($entree)) {
// set the owning side to null (unless already changed)
if ($entree->getChorale() === $this) {
$entree->setChorale(null);
}
}
return $this;
}
/**
* @return Collection<int, AdherentProjets>
*/
public function getAdherentProjets(): Collection
{
return $this->adherentProjets;
}
public function addAdherentProjet(AdherentProjets $adherentProjet): static
{
if (!$this->adherentProjets->contains($adherentProjet)) {
$this->adherentProjets->add($adherentProjet);
$adherentProjet->setChorale($this);
}
return $this;
}
public function removeAdherentProjet(AdherentProjets $adherentProjet): static
{
if ($this->adherentProjets->removeElement($adherentProjet)) {
// set the owning side to null (unless already changed)
if ($adherentProjet->getChorale() === $this) {
$adherentProjet->setChorale(null);
}
}
return $this;
}
public function __toString() {
return $this->libelle;
}
/**
* @return Collection<int, ConfigurationDonReconnaissance>
*/
public function getConfigurationDonReconnaissances(): Collection
{
return $this->configurationDonReconnaissances;
}
public function addConfigurationDonReconnaissance(ConfigurationDonReconnaissance $configurationDonReconnaissance): static
{
if (!$this->configurationDonReconnaissances->contains($configurationDonReconnaissance)) {
$this->configurationDonReconnaissances->add($configurationDonReconnaissance);
$configurationDonReconnaissance->setChorale($this);
}
return $this;
}
public function removeConfigurationDonReconnaissance(ConfigurationDonReconnaissance $configurationDonReconnaissance): static
{
if ($this->configurationDonReconnaissances->removeElement($configurationDonReconnaissance)) {
// set the owning side to null (unless already changed)
if ($configurationDonReconnaissance->getChorale() === $this) {
$configurationDonReconnaissance->setChorale(null);
}
}
return $this;
}
}