<?php
namespace App\Entity;
use App\Repository\ProjectRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProjectRepository::class)]
class Project
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'projects')]
private ?Contact $contact = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $date_creation = null;
#[ORM\OneToMany(mappedBy: 'projet', targetEntity: Document::class, cascade: ['remove'])]
private Collection $documents;
#[ORM\OneToMany(mappedBy: 'projet', targetEntity: Image::class, cascade: ['remove'])]
private Collection $images;
#[ORM\OneToMany(mappedBy: 'projet', targetEntity: Dossier::class, cascade: ['remove'])]
private Collection $dossiers;
#[ORM\OneToMany(mappedBy: 'project', targetEntity: VariableValue::class)]
private Collection $variableValues;
#[ORM\ManyToOne(inversedBy: 'projects')]
private ?ProjectType $project_type = null;
#[ORM\ManyToOne(inversedBy: 'projects')]
private ?User $utilisateur = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_debut = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_fin = null;
#[ORM\OneToMany(mappedBy: 'projet', targetEntity: Fichier::class)]
private Collection $fichiers;
public function __construct()
{
$this->documents = new ArrayCollection();
$this->images = new ArrayCollection();
$this->dossiers = new ArrayCollection();
$this->variableValues = new ArrayCollection();
$this->fichiers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getContact(): ?Contact
{
return $this->contact;
}
public function setContact(?Contact $contact): static
{
$this->contact = $contact;
return $this;
}
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;
}
/**
* @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->setProjet($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->getProjet() === $this) {
$document->setProjet(null);
}
}
return $this;
}
/**
* @return Collection<int, Image>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Image $image): static
{
if (!$this->images->contains($image)) {
$this->images->add($image);
$image->setProjet($this);
}
return $this;
}
public function removeImage(Image $image): static
{
if ($this->images->removeElement($image)) {
// set the owning side to null (unless already changed)
if ($image->getProjet() === $this) {
$image->setProjet(null);
}
}
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->setProjet($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->getProjet() === $this) {
$dossier->setProjet(null);
}
}
return $this;
}
/**
* @return Collection<int, VariableValue>
*/
public function getVariableValues(): Collection
{
return $this->variableValues;
}
public function addVariableValue(VariableValue $variableValue): static
{
if (!$this->variableValues->contains($variableValue)) {
$this->variableValues->add($variableValue);
$variableValue->setProject($this);
}
return $this;
}
public function removeVariableValue(VariableValue $variableValue): static
{
if ($this->variableValues->removeElement($variableValue)) {
// set the owning side to null (unless already changed)
if ($variableValue->getProject() === $this) {
$variableValue->setProject(null);
}
}
return $this;
}
public function getProjectType(): ?ProjectType
{
return $this->project_type;
}
public function setProjectType(?ProjectType $project_type): static
{
$this->project_type = $project_type;
return $this;
}
public function getUtilisateur(): ?User
{
return $this->utilisateur;
}
public function setUtilisateur(?User $utilisateur): static
{
$this->utilisateur = $utilisateur;
return $this;
}
public function getDateDebut(): ?\DateTimeInterface
{
return $this->date_debut;
}
public function setDateDebut(?\DateTimeInterface $date_debut): static
{
$this->date_debut = $date_debut;
return $this;
}
public function getDateFin(): ?\DateTimeInterface
{
return $this->date_fin;
}
public function setDateFin(?\DateTimeInterface $date_fin): static
{
$this->date_fin = $date_fin;
return $this;
}
/**
* @return Collection<int, Fichier>
*/
public function getFichiers(): Collection
{
return $this->fichiers;
}
public function addFichier(Fichier $fichier): static
{
if (!$this->fichiers->contains($fichier)) {
$this->fichiers->add($fichier);
$fichier->setProjet($this);
}
return $this;
}
public function removeFichier(Fichier $fichier): static
{
if ($this->fichiers->removeElement($fichier)) {
// set the owning side to null (unless already changed)
if ($fichier->getProjet() === $this) {
$fichier->setProjet(null);
}
}
return $this;
}
}