src/Entity/Contact.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContactRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassContactRepository::class)]
  9. class Contact
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $denomination null;
  17.     #[ORM\Column(length9)]
  18.     private ?string $siren null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $nom null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $tel1 null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $email null;
  25.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  26.     private ?\DateTimeInterface $date_creation null;
  27.     #[ORM\Column(typeTypes::INTEGERoptions: ['default' => 1])]
  28.     private int $etat 1;
  29.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  30.     private ?array $data null;
  31.     #[ORM\OneToMany(mappedBy'contact'targetEntityObjet::class, cascade: ['remove'])]
  32.     private Collection $objets;
  33.     #[ORM\OneToMany(mappedBy'contact'targetEntityDossier::class, cascade: ['remove'])]
  34.     private Collection $dossiers;
  35.     #[ORM\ManyToOne(inversedBy'contacts')]
  36.     private ?ContactType $contact_type null;
  37.     #[ORM\OneToMany(mappedBy'contact'targetEntityVariableValue::class, cascade: ['remove'])]
  38.     private Collection $variableValues;
  39.     #[ORM\ManyToOne(inversedBy'associatedContacts')]
  40.     #[ORM\JoinColumn(name"parent_contact_id"referencedColumnName"id"nullabletrue)]
  41.     private ?Contact $parentContact;
  42.     #[ORM\OneToMany(mappedBy'parentContact'targetEntityContact::class, cascade: ['remove'])]
  43.     private Collection $associatedContacts;
  44.     #[ORM\Column(length255nullabletrue)]
  45.     private ?string $compte_client null;
  46.     #[ORM\Column(length255nullabletrue)]
  47.     private ?string $tel2 null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     private ?string $adresse null;
  50.     #[ORM\Column(length255nullabletrue)]
  51.     private ?string $siret null;
  52.     #[ORM\Column(nullabletrue)]
  53.     private ?bool $emailing null;
  54.     #[ORM\Column(nullabletrue)]
  55.     private ?bool $antispam null;
  56.     #[ORM\ManyToOne(inversedBy'contacts')]
  57.     private ?User $utilisateur null;
  58.     #[ORM\OneToMany(mappedBy'contact'targetEntityFichier::class)]
  59.     private Collection $fichiers;
  60.     public function __construct()
  61.     {
  62.         $this->objets = new ArrayCollection();
  63.         $this->dossiers = new ArrayCollection();
  64.         $this->variableValues = new ArrayCollection();
  65.         $this->associatedContacts = new ArrayCollection();
  66.         $this->fichiers = new ArrayCollection();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getDenomination(): ?string
  73.     {
  74.         return $this->denomination;
  75.     }
  76.     public function setDenomination(string $denomination): static
  77.     {
  78.         $this->denomination $denomination;
  79.         return $this;
  80.     }
  81.     public function getSiren(): ?string
  82.     {
  83.         return $this->siren;
  84.     }
  85.     public function setSiren(string $siren): static
  86.     {
  87.         $this->siren $siren;
  88.         return $this;
  89.     }
  90.     public function getNom(): ?string
  91.     {
  92.         return $this->nom;
  93.     }
  94.     public function setNom(string $nom): static
  95.     {
  96.         $this->nom $nom;
  97.         return $this;
  98.     }
  99.     public function getTel1(): ?string
  100.     {
  101.         return $this->tel1;
  102.     }
  103.     public function setTel1(string $tel1): static
  104.     {
  105.         $this->tel1 $tel1;
  106.         return $this;
  107.     }
  108.     public function getEmail(): ?string
  109.     {
  110.         return $this->email;
  111.     }
  112.     public function setEmail(string $email): static
  113.     {
  114.         $this->email $email;
  115.         return $this;
  116.     }
  117.     public function getDateCreation(): ?\DateTimeInterface
  118.     {
  119.         return $this->date_creation;
  120.     }
  121.     public function setDateCreation(\DateTimeInterface $date_creation): static
  122.     {
  123.         $this->date_creation $date_creation;
  124.         return $this;
  125.     }
  126.     public function setObjets(Collection $objets): static
  127.     {
  128.         $this->objets $objets;
  129.         return $this;
  130.     }
  131.     /**
  132.      * @return Collection<int, Objet>
  133.      */
  134.     public function getObjets(): Collection
  135.     {
  136.         return $this->objets;
  137.     }
  138.     /**
  139.      * @return Collection<int, Objet>
  140.      */
  141.     public function getLevelOneObjets(): Collection
  142.     {
  143.         $levelOneObjets = new ArrayCollection();
  144.         foreach ($this->objets as $objet) {
  145.             if (!$objet->getObjet()) {
  146.                 $levelOneObjets->add($objet);
  147.             }
  148.         }
  149.         return $levelOneObjets;
  150.     }
  151.     /**
  152.      * @return Collection<int, Objet>
  153.      */
  154.     public function getObjetsLevelOneObjetType(): Collection
  155.     {
  156.         return $this->objets;
  157.     }
  158.     public function addObjet(Objet $objet): static
  159.     {
  160.         if (!$this->objets->contains($objet)) {
  161.             $this->objets->add($objet);
  162.             $objet->setContact($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeObjet(Objet $objet): static
  167.     {
  168.         if ($this->objets->removeElement($objet)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($objet->getContact() === $this) {
  171.                 $objet->setContact(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return Collection<int, Dossier>
  178.      */
  179.     public function getDossiers(): Collection
  180.     {
  181.         return $this->dossiers;
  182.     }
  183.     public function addDossier(Dossier $dossier): static
  184.     {
  185.         if (!$this->dossiers->contains($dossier)) {
  186.             $this->dossiers->add($dossier);
  187.             $dossier->setContact($this);
  188.         }
  189.         return $this;
  190.     }
  191.     public function removeDossier(Dossier $dossier): static
  192.     {
  193.         if ($this->dossiers->removeElement($dossier)) {
  194.             // set the owning side to null (unless already changed)
  195.             if ($dossier->getContact() === $this) {
  196.                 $dossier->setContact(null);
  197.             }
  198.         }
  199.         return $this;
  200.     }
  201.     public function getContactType(): ?ContactType
  202.     {
  203.         return $this->contact_type;
  204.     }
  205.     public function setContactType(?ContactType $contact_type): static
  206.     {
  207.         $this->contact_type $contact_type;
  208.         return $this;
  209.     }
  210.     /**
  211.      * @return Collection<int, VariableValue>
  212.      */
  213.     public function getVariableValues(): Collection
  214.     {
  215.         return $this->variableValues;
  216.     }
  217.     public function addVariableValue(VariableValue $variableValue): static
  218.     {
  219.         if (!$this->variableValues->contains($variableValue)) {
  220.             $this->variableValues->add($variableValue);
  221.             $variableValue->setContact($this);
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeVariableValue(VariableValue $variableValue): static
  226.     {
  227.         if ($this->variableValues->removeElement($variableValue)) {
  228.             // set the owning side to null (unless already changed)
  229.             if ($variableValue->getContact() === $this) {
  230.                 $variableValue->setContact(null);
  231.             }
  232.         }
  233.         return $this;
  234.     }
  235.     public function getParentContact(): ?Contact
  236.     {
  237.         return $this->parentContact;
  238.     }
  239.     public function setParentContact(?Contact $parentContact): static
  240.     {
  241.         $this->parentContact $parentContact;
  242.         return $this;
  243.     }
  244.     public function setAssociatedContacts(Collection $associatedContacts): static
  245.     {
  246.         $this->associatedContacts $associatedContacts;
  247.         return $this;
  248.     }
  249.     /**
  250.      * @return Collection<int, Contact>
  251.      */
  252.     public function getAssociatedContacts(): Collection
  253.     {
  254.         return $this->associatedContacts;
  255.     }
  256.     public function addAssociatedContact(Contact $associatedContact): static
  257.     {
  258.         if (!$this->associatedContacts->contains($associatedContact)) {
  259.             $this->associatedContacts->add($associatedContact);
  260.             $associatedContact->setParentContact($this);
  261.         }
  262.         return $this;
  263.     }
  264.     public function removeAssociatedContact(Contact $associatedContact): static
  265.     {
  266.         if ($this->associatedContacts->removeElement($associatedContact)) {
  267.             $associatedContact->setParentContact(null);
  268.         }
  269.         return $this;
  270.     }
  271.     public function getCompteClient(): ?string
  272.     {
  273.         return $this->compte_client;
  274.     }
  275.     public function setCompteClient(?string $compte_client): static
  276.     {
  277.         $this->compte_client $compte_client;
  278.         return $this;
  279.     }
  280.     public function getTel2(): ?string
  281.     {
  282.         return $this->tel2;
  283.     }
  284.     public function setTel2(?string $tel2): static
  285.     {
  286.         $this->tel2 $tel2;
  287.         return $this;
  288.     }
  289.     public function getAdresse(): ?string
  290.     {
  291.         return $this->adresse;
  292.     }
  293.     public function setAdresse(?string $adresse): static
  294.     {
  295.         $this->adresse $adresse;
  296.         return $this;
  297.     }
  298.     public function getSiret(): ?string
  299.     {
  300.         return $this->siret;
  301.     }
  302.     public function setSiret(?string $siret): static
  303.     {
  304.         $this->siret $siret;
  305.         return $this;
  306.     }
  307.     public function isEmailing(): ?bool
  308.     {
  309.         return $this->emailing;
  310.     }
  311.     public function setEmailing(?bool $emailing): static
  312.     {
  313.         $this->emailing $emailing;
  314.         return $this;
  315.     }
  316.     public function isAntispam(): ?bool
  317.     {
  318.         return $this->antispam;
  319.     }
  320.     public function setAntispam(?bool $antispam): static
  321.     {
  322.         $this->antispam $antispam;
  323.         return $this;
  324.     }
  325.     public function getUtilisateur(): ?User
  326.     {
  327.         return $this->utilisateur;
  328.     }
  329.     public function setUtilisateur(?User $utilisateur): static
  330.     {
  331.         $this->utilisateur $utilisateur;
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, Fichier>
  336.      */
  337.     public function getFichiers(): Collection
  338.     {
  339.         return $this->fichiers;
  340.     }
  341.     public function addFichier(Fichier $fichier): static
  342.     {
  343.         if (!$this->fichiers->contains($fichier)) {
  344.             $this->fichiers->add($fichier);
  345.             $fichier->setContact($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeFichier(Fichier $fichier): static
  350.     {
  351.         if ($this->fichiers->removeElement($fichier)) {
  352.             // set the owning side to null (unless already changed)
  353.             if ($fichier->getContact() === $this) {
  354.                 $fichier->setContact(null);
  355.             }
  356.         }
  357.         return $this;
  358.     }
  359.     public function __toString()
  360.     {
  361.         return (string) $this->id;  // Ou une autre propriété qui représente bien l'objet
  362.     }
  363.     public function getEtat(): int
  364.     {
  365.         return $this->etat;
  366.     }
  367.     public function setEtat(int $etat): static
  368.     {
  369.         $this->etat $etat;
  370.         return $this;
  371.     }
  372.     public function getData(): ?array
  373.     {
  374.         return $this->data;
  375.     }
  376.     public function setData(?array $data): static
  377.     {
  378.         $this->data $data;
  379.         return $this;
  380.     }
  381. }