<?php
namespace App\Entity;
use App\Repository\GroupeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: GroupeRepository::class)]
#[ORM\Table(name: "groupes")]
class Groupe
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', nullable: true, length: 255)]
private $code;
#[ORM\Column(type: 'text')]
private $nom;
#[ORM\ManyToMany(targetEntity: Ptf::class, mappedBy: 'groupe')]
private $ptfs;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(type: 'datetime')]
private $created_at;
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(type: 'datetime')]
private $updated_at;
#[ORM\Column(type: 'integer')]
private $created_by;
#[ORM\Column(type: 'integer')]
private $updated_by;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $file;
#[ORM\OneToMany(mappedBy: 'groupe', targetEntity: StructureAssocie::class)]
private $structureAssocies;
#[ORM\ManyToMany(targetEntity: Domaine::class, inversedBy: 'groupes')]
private $domaine;
#[ORM\ManyToOne(targetEntity: Ptf::class)]
private $chef;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slide = null;
#[ORM\OneToMany(mappedBy: 'groupe', targetEntity: Document::class)]
private Collection $documents;
#[ORM\OneToMany(mappedBy: 'groupe', targetEntity: Evenement::class)]
private Collection $evenements;
#[ORM\Column(type: Types::TEXT)]
private ?string $resume = null;
#[ORM\ManyToOne(inversedBy: 'groupes')]
private ?User $user = null;
public function __construct()
{
$this->ptfs = new ArrayCollection();
$this->structureAssocies = new ArrayCollection();
$this->domaine = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->evenements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
/**
* @return Collection<int, Ptf>
*/
public function getPtfs(): Collection
{
return $this->ptfs;
}
public function addPtf(Ptf $ptf): self
{
if (!$this->ptfs->contains($ptf)) {
$this->ptfs[] = $ptf;
$ptf->addGroupe($this);
}
return $this;
}
public function removePtf(Ptf $ptf): self
{
if ($this->ptfs->removeElement($ptf)) {
$ptf->removeGroupe($this);
}
return $this;
}
public function removeAllPtf(): self
{
foreach ($this->ptfs as $ptf) {
$this->removePtf($ptf);
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getCreatedBy(): ?int
{
return $this->created_by;
}
public function setCreatedBy(int $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getUpdatedBy(): ?int
{
return $this->updated_by;
}
public function setUpdatedBy(int $updated_by): self
{
$this->updated_by = $updated_by;
return $this;
}
public function getFile(): ?string
{
return $this->file;
}
public function setFile(?string $file): self
{
$this->file = $file;
return $this;
}
/**
* @return Collection<int, StructureAssocie>
*/
public function getStructureAssocies(): Collection
{
return $this->structureAssocies;
}
public function addStructureAssocy(StructureAssocie $structureAssocy): self
{
if (!$this->structureAssocies->contains($structureAssocy)) {
$this->structureAssocies[] = $structureAssocy;
$structureAssocy->setGroupe($this);
}
return $this;
}
public function removeStructureAssocy(StructureAssocie $structureAssocy): self
{
if ($this->structureAssocies->removeElement($structureAssocy)) {
// set the owning side to null (unless already changed)
if ($structureAssocy->getGroupe() === $this) {
$structureAssocy->setGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, Domaine>
*/
public function getDomaine(): Collection
{
return $this->domaine;
}
public function addDomaine(Domaine $domaine): self
{
if (!$this->domaine->contains($domaine)) {
$this->domaine[] = $domaine;
}
return $this;
}
public function removeDomaine(Domaine $domaine): self
{
$this->domaine->removeElement($domaine);
return $this;
}
public function removeAllDomaine(): self
{
foreach ($this->domaine as $d) {
$this->removeDomaine($d);
}
return $this;
}
public function getChef(): ?Ptf
{
return $this->chef;
}
public function setChef(?Ptf $chef): self
{
$this->chef = $chef;
return $this;
}
public function getSlide(): ?string
{
return $this->slide;
}
public function setSlide(?string $slide): self
{
$this->slide = $slide;
return $this;
}
/**
* @return Collection<int, Document>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setGroupe($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getGroupe() === $this) {
$document->setGroupe(null);
}
}
return $this;
}
/**
* @return Collection<int, Evenement>
*/
public function getEvenements(): Collection
{
return $this->evenements;
}
public function addEvenement(Evenement $evenement): self
{
if (!$this->evenements->contains($evenement)) {
$this->evenements->add($evenement);
$evenement->setGroupe($this);
}
return $this;
}
public function removeEvenement(Evenement $evenement): self
{
if ($this->evenements->removeElement($evenement)) {
// set the owning side to null (unless already changed)
if ($evenement->getGroupe() === $this) {
$evenement->setGroupe(null);
}
}
return $this;
}
public function getResume(): ?string
{
return $this->resume;
}
public function setResume(string $resume): self
{
$this->resume = $resume;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
}