<?php
namespace App\Entity;
use App\Attributes\ClassNameConverter;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: 'App\Repository\ContactRepository')]
#[Gedmo\Loggable]
#[ClassNameConverter(name: 'Contact')]
class Contact extends EntityStatus
{
public const TYPE_TRADER = 1;
public const TYPE_ADMINISTRATION = 2;
public const TYPE_PARTNER = 3;
public const TYPE_FELLER = 4;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $typeContact = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $nom = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $prenom = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $telPortable = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $telPortable2 = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $telBureau = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $emailContact = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', nullable: true)]
private ?string $dateNaissance = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $commentaire = null;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: 'App\Entity\CommissionContact', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: true)]
private Collection $commissionsContacts;
#[ORM\OneToOne(mappedBy: 'contactResponsable', targetEntity: 'App\Entity\Entreprise', cascade: ['persist', 'remove'])]
private ?Entreprise $entreprise;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $adresse = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $adresse2 = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $ville = null;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 60, nullable: true)]
private ?string $codePostal = null;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: 'App\Entity\SyndicatContact', cascade: ['persist'])]
#[Assert\Valid]
private Collection $syndicatContacts;
#[Gedmo\Versioned]
#[ORM\Column(type: 'boolean', nullable: false)]
private ?bool $isResponsible = false;
#[Gedmo\Versioned]
#[ORM\Column(type: 'boolean', nullable: false)]
private ?bool $isPrivileged = false;
#[ORM\ManyToMany(targetEntity: 'App\Entity\Repere', cascade: ['persist'])]
#[ORM\JoinColumn(nullable: true)]
private Collection $repere;
#[Gedmo\Versioned]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $civilite = null;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: 'App\Entity\ContactConseilAdministration', cascade: ['persist'])]
private Collection $contactConseilAdministrations;
#[Gedmo\Versioned]
#[ORM\ManyToOne(inversedBy: 'contacts')]
#[ORM\JoinColumn(nullable: true, onDelete: "SET NULL")]
private ?Entreprise $firm = null;
#[Gedmo\Versioned]
#[ORM\OneToOne(mappedBy: 'contact', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: true, onDelete: "SET NULL")]
private ?User $user = null;
#[ORM\ManyToOne(inversedBy: 'contacts')]
private ?Etablissement $etablissement = null;
#[ORM\Column(nullable: true)]
private ?int $type = self::TYPE_TRADER;
#[ORM\OneToMany(mappedBy: 'contact', targetEntity: FirmContactQualiNegoce::class, orphanRemoval: true)]
private Collection $firmContactQualiNegoces;
public function __construct()
{
$this->repere = new ArrayCollection();
$this->commissionsContacts = new ArrayCollection();
$this->syndicatContacts = new ArrayCollection();
$this->contactConseilAdministrations = new ArrayCollection();
$this->firmContactQualiNegoces = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTypeContact(): ?string
{
return $this->typeContact;
}
public function setTypeContact(?string $typeContact): self
{
$this->typeContact = $typeContact;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getPrenom(): ?string
{
return $this->prenom;
}
public function setPrenom(?string $prenom): self
{
$this->prenom = $prenom;
return $this;
}
public function getFullname(): string
{
return $this->nom.' '.$this->prenom;
}
public function getTelPortable(): ?string
{
return $this->telPortable;
}
public function setTelPortable(?string $telPortable): self
{
$this->telPortable = $telPortable;
return $this;
}
public function getTelBureau(): ?string
{
return $this->telBureau;
}
public function setTelBureau(?string $telBureau): self
{
$this->telBureau = $telBureau;
return $this;
}
public function getEmailContact(): ?string
{
return $this->emailContact;
}
public function getDateNaissance(): ?string
{
return $this->dateNaissance;
}
/**
* @param mixed $dateNaissance
* @return Contact
*/
public function setDateNaissance(?string $dateNaissance): self
{
$this->dateNaissance = $dateNaissance;
return $this;
}
public function setEmailContact(?string $emailContact): self
{
$this->emailContact = $emailContact;
return $this;
}
public function getCommentaire(): ?string
{
return $this->commentaire;
}
public function setCommentaire(?string $commentaire): self
{
$this->commentaire = $commentaire;
return $this;
}
public function getRepere(): Collection
{
return $this->repere;
}
public function addRepere(Repere $repere): self
{
if (!$this->repere->contains($repere)) {
$this->repere[] = $repere;
}
return $this;
}
public function removeRepere(Repere $repere): self
{
if ($this->repere->contains($repere)) {
$this->repere->removeElement($repere);
}
return $this;
}
/*public function getEntreprises(): Collection
{
return $this->entreprises;
}
public function addEntreprise(Entreprise $entreprise): self
{
if (!$this->entreprises->contains($entreprise)) {
$this->entreprises[] = $entreprise;
$entreprise->addContact($this);
}
return $this;
}
public function removeEntreprise(Entreprise $entreprise): self
{
if ($this->entreprises->contains($entreprise)) {
$this->entreprises->removeElement($entreprise);
$entreprise->removeContact($this);
}
return $this;
}*/
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getCodePostal(): ?string
{
return $this->codePostal;
}
public function setCodePostal(?string $codePostal): self
{
$this->codePostal = $codePostal;
return $this;
}
public function getCommissionsContacts(): ArrayCollection|Collection
{
return $this->commissionsContacts;
}
public function addCommissionsContact(CommissionContact $commissionsContact): self
{
if (!$this->commissionsContacts->contains($commissionsContact)) {
$this->commissionsContacts[] = $commissionsContact;
$commissionsContact->setContact($this);
}
return $this;
}
public function removeCommissionsContact(CommissionContact $commissionsContact): self
{
if ($this->commissionsContacts->contains($commissionsContact)) {
$this->commissionsContacts->removeElement($commissionsContact);
// set the owning side to null (unless already changed)
if ($commissionsContact->getContact() === $this) {
$commissionsContact->setContact(null);
}
}
return $this;
}
public function getSyndicatContacts(): Collection
{
return $this->syndicatContacts;
}
public function setSyndicatContacts(Collection $syndicatContacts): self
{
$this->syndicatContacts = $syndicatContacts;
return $this;
}
public function addSyndicatContact(SyndicatContact $syndicatContact): self
{
if (!$this->syndicatContacts->contains($syndicatContact)) {
$this->syndicatContacts[] = $syndicatContact;
$syndicatContact->setContact($this);
}
return $this;
}
public function removeSyndicatContact(SyndicatContact $syndicatContact): self
{
if ($this->syndicatContacts->contains($syndicatContact)) {
$this->syndicatContacts->removeElement($syndicatContact);
// set the owning side to null (unless already changed)
if ($syndicatContact->getContact() === $this) {
$syndicatContact->setContact(null);
}
}
return $this;
}
public function getIsResponsible(): ?bool
{
return $this->isResponsible;
}
public function setIsResponsible(?bool $isResponsible): self
{
$this->isResponsible = $isResponsible;
return $this;
}
public function getIsPrivileged(): ?bool
{
return $this->isPrivileged;
}
public function setIsPrivileged(?bool $isPrivileged): self
{
$this->isPrivileged = $isPrivileged;
return $this;
}
/*public function getReperesExistants(): Collection
{
return $this->reperesExistants;
}
public function addReperesExistant(Repere $reperesExistant): self
{
if (!$this->reperesExistants->contains($reperesExistant)) {
$this->reperesExistants[] = $reperesExistant;
}
return $this;
}
public function removeReperesExistant(Repere $reperesExistant): self
{
if ($this->reperesExistants->contains($reperesExistant)) {
$this->reperesExistants->removeElement($reperesExistant);
}
return $this;
}*/
public function getCivilite(): ?string
{
return $this->civilite;
}
public function setCivilite(?string $civilite): self
{
$this->civilite = $civilite;
return $this;
}
public function getTelPortable2(): ?string
{
return $this->telPortable2;
}
public function setTelPortable2(?string $telPortable2): self
{
$this->telPortable2 = $telPortable2;
return $this;
}
public function getAdresse2(): ?string
{
return $this->adresse2;
}
public function setAdresse2(?string $adresse2): self
{
$this->adresse2 = $adresse2;
return $this;
}
public function getContactConseilAdministrations(): Collection
{
return $this->contactConseilAdministrations;
}
public function addContactConseilAdministration(ContactConseilAdministration $contactConseilAdministration): self
{
if (!$this->contactConseilAdministrations->contains($contactConseilAdministration)) {
$this->contactConseilAdministrations[] = $contactConseilAdministration;
$contactConseilAdministration->setContact($this);
}
return $this;
}
public function removeContactConseilAdministration(ContactConseilAdministration $contactConseilAdministration): self
{
if ($this->contactConseilAdministrations->contains($contactConseilAdministration)) {
$this->contactConseilAdministrations->removeElement($contactConseilAdministration);
// set the owning side to null (unless already changed)
if ($contactConseilAdministration->getContact() === $this) {
$contactConseilAdministration->setContact(null);
}
}
return $this;
}
public function getFirm(): ?Entreprise
{
return $this->firm;
}
public function setFirm(?Entreprise $firm): self
{
$this->firm = $firm;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
// unset the owning side of the relation if necessary
if ($user === null && $this->user !== null) {
$this->user->setContact(null);
}
// set the owning side of the relation if necessary
if ($user !== null && $user->getContact() !== $this) {
$user->setContact($this);
}
$this->user = $user;
return $this;
}
public function getEtablissement(): ?Etablissement
{
return $this->etablissement;
}
public function setEtablissement(?Etablissement $etablissement): self
{
$this->etablissement = $etablissement;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(?int $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection<int, FirmContactQualiNegoce>
*/
public function getFirmContactQualiNegoces(): Collection
{
return $this->firmContactQualiNegoces;
}
public function addFirmContactQualiNegoce(FirmContactQualiNegoce $firmContactQualiNegoce): self
{
if (!$this->firmContactQualiNegoces->contains($firmContactQualiNegoce)) {
$this->firmContactQualiNegoces->add($firmContactQualiNegoce);
$firmContactQualiNegoce->setContact($this);
}
return $this;
}
public function removeFirmContactQualiNegoce(FirmContactQualiNegoce $firmContactQualiNegoce): self
{
if ($this->firmContactQualiNegoces->removeElement($firmContactQualiNegoce)) {
// set the owning side to null (unless already changed)
if ($firmContactQualiNegoce->getContact() === $this) {
$firmContactQualiNegoce->setContact(null);
}
}
return $this;
}
}