<?php
namespace App\Entity;
use App\Repository\DossierDocTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DossierDocTypeRepository::class)]
class DossierDocType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $date_creation = null;
#[ORM\Column]
private ?int $ordre = null;
#[ORM\OneToMany(mappedBy: 'dossier_type', targetEntity: Dossier::class)]
private Collection $dossiers;
#[ORM\OneToMany(mappedBy: 'doc_type', targetEntity: Document::class)]
private Collection $documents;
public function __construct()
{
$this->dossiers = new ArrayCollection();
$this->documents = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): static
{
$this->label = $label;
return $this;
}
public function getDateCreation(): ?\DateTimeInterface
{
return $this->date_creation;
}
public function setDateCreation(\DateTimeInterface $date_creation): static
{
$this->date_creation = $date_creation;
return $this;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(int $ordre): static
{
$this->ordre = $ordre;
return $this;
}
/**
* @return Collection<int, Dossier>
*/
public function getDossiers(): Collection
{
return $this->dossiers;
}
public function addDossier(Dossier $dossier): static
{
if (!$this->dossiers->contains($dossier)) {
$this->dossiers->add($dossier);
$dossier->setDossierType($this);
}
return $this;
}
public function removeDossier(Dossier $dossier): static
{
if ($this->dossiers->removeElement($dossier)) {
// set the owning side to null (unless already changed)
if ($dossier->getDossierType() === $this) {
$dossier->setDossierType(null);
}
}
return $this;
}
/**
* @return Collection<int, Document>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): static
{
if (!$this->documents->contains($document)) {
$this->documents->add($document);
$document->setDocType($this);
}
return $this;
}
public function removeDocument(Document $document): static
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getDocType() === $this) {
$document->setDocType(null);
}
}
return $this;
}
}