<?php
namespace App\Entity;
use App\Repository\ContactRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ContactRepository::class)]
class Contact
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $denomination = null;
#[ORM\Column(length: 9)]
private ?string $siren = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(length: 255)]
private ?string $tel1 = null;
#[ORM\Column(length: 255)]
private ?string $email = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $date_creation = null;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: Project::class, cascade: ['remove'])]
private Collection $projects;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: Dossier::class, cascade: ['remove'])]
private Collection $dossiers;
#[ORM\ManyToOne(inversedBy: 'contacts')]
private ?ContactType $contact_type = null;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: VariableValue::class, cascade: ['remove'])]
private Collection $variableValues;
#[ORM\ManyToOne(inversedBy: 'associatedContacts')]
#[ORM\JoinColumn(name: "parent_contact_id", referencedColumnName: "id", nullable: true)]
private ?Contact $parentContact;
#[ORM\OneToMany(mappedBy: 'parentContact', targetEntity: Contact::class, cascade: ['remove'])]
private Collection $associatedContacts;
#[ORM\Column(length: 255, nullable: true)]
private ?string $compte_client = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tel2 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $adresse = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $siret = null;
#[ORM\Column(nullable: true)]
private ?bool $emailing = null;
#[ORM\Column(nullable: true)]
private ?bool $antispam = null;
#[ORM\ManyToOne(inversedBy: 'contacts')]
private ?User $utilisateur = null;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: Fichier::class)]
private Collection $fichiers;
public function __construct()
{
$this->projects = new ArrayCollection();
$this->dossiers = new ArrayCollection();
$this->variableValues = new ArrayCollection();
$this->associatedContacts = new ArrayCollection();
$this->fichiers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDenomination(): ?string
{
return $this->denomination;
}
public function setDenomination(string $denomination): static
{
$this->denomination = $denomination;
return $this;
}
public function getSiren(): ?string
{
return $this->siren;
}
public function setSiren(string $siren): static
{
$this->siren = $siren;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): static
{
$this->nom = $nom;
return $this;
}
public function getTel1(): ?string
{
return $this->tel1;
}
public function setTel1(string $tel1): static
{
$this->tel1 = $tel1;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): static
{
$this->email = $email;
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, Project>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Project $project): static
{
if (!$this->projects->contains($project)) {
$this->projects->add($project);
$project->setContact($this);
}
return $this;
}
public function removeProject(Project $project): static
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getContact() === $this) {
$project->setContact(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->setContact($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->getContact() === $this) {
$dossier->setContact(null);
}
}
return $this;
}
public function getContactType(): ?ContactType
{
return $this->contact_type;
}
public function setContactType(?ContactType $contact_type): static
{
$this->contact_type = $contact_type;
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->setContact($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->getContact() === $this) {
$variableValue->setContact(null);
}
}
return $this;
}
public function getParentContact(): ?Contact
{
return $this->parentContact;
}
public function setParentContact(?Contact $parentContact): static
{
$this->parentContact = $parentContact;
return $this;
}
/**
* @return Collection<int, Contact>
*/
public function getAssociatedContacts(): Collection
{
return $this->associatedContacts;
}
public function addAssociatedContact(Contact $associatedContact): static
{
if (!$this->associatedContacts->contains($associatedContact)) {
$this->associatedContacts->add($associatedContact);
$associatedContact->setParentContact($this);
}
return $this;
}
public function removeAssociatedContact(Contact $associatedContact): static
{
if ($this->associatedContacts->removeElement($associatedContact)) {
$associatedContact->setParentContact(null);
}
return $this;
}
public function getCompteClient(): ?string
{
return $this->compte_client;
}
public function setCompteClient(?string $compte_client): static
{
$this->compte_client = $compte_client;
return $this;
}
public function getTel2(): ?string
{
return $this->tel2;
}
public function setTel2(?string $tel2): static
{
$this->tel2 = $tel2;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): static
{
$this->adresse = $adresse;
return $this;
}
public function getSiret(): ?string
{
return $this->siret;
}
public function setSiret(?string $siret): static
{
$this->siret = $siret;
return $this;
}
public function isEmailing(): ?bool
{
return $this->emailing;
}
public function setEmailing(?bool $emailing): static
{
$this->emailing = $emailing;
return $this;
}
public function isAntispam(): ?bool
{
return $this->antispam;
}
public function setAntispam(?bool $antispam): static
{
$this->antispam = $antispam;
return $this;
}
public function getUtilisateur(): ?User
{
return $this->utilisateur;
}
public function setUtilisateur(?User $utilisateur): static
{
$this->utilisateur = $utilisateur;
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->setContact($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->getContact() === $this) {
$fichier->setContact(null);
}
}
return $this;
}
public function __toString() {
return (string) $this->id; // Ou une autre propriété qui représente bien l'objet
}
}