src/Entity/Entreprises.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EntreprisesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassEntreprisesRepository::class)]
  8. class Entreprises extends User
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type"integer")]
  13.     private $id;
  14.     #[ORM\Column(type'string'length50)]
  15.     private $raison_sociale;
  16.     #[ORM\Column(type'string'length50)]
  17.     private $adresse;
  18.     #[ORM\Column(type'string'length50)]
  19.     private $ville;
  20.     #[ORM\Column(type'string'length50)]
  21.     private $cp;
  22.     #[ORM\Column(type'string'length50)]
  23.     private $numero_siret;
  24.     #[ORM\Column(type'blob'nullabletrue)]
  25.     private $logo_entreprise;
  26.     #[ORM\Column(type'string'length50nullabletrue)]
  27.     private $fonction_entreprise;
  28.     #[ORM\Column(type'string'length50)]
  29.     private $nom;
  30.     #[ORM\Column(type'string'length50)]
  31.     private $prenom;
  32.     #[ORM\Column(type'string'length50)]
  33.     private $genre;
  34.     #[ORM\OneToMany(mappedBy'entreprise'targetEntityAvisConsultant::class)]
  35.     private $avisConsultants;
  36.     #[ORM\OneToMany(mappedBy'entreprise'targetEntityComerciaux::class)]
  37.     private $comerciauxes;
  38.     #[ORM\ManyToOne(targetEntityTypeEntreprise::class, inversedBy'entreprises')]
  39.     private $type_entreprise;
  40.     #[ORM\ManyToMany(targetEntityServices::class, inversedBy'entreprises')]
  41.     private $service;
  42.     #[ORM\OneToMany(mappedBy'entreprise'targetEntityMissions::class)]
  43.     private $missions;
  44.     #[ORM\Column(type'text'nullabletrue)]
  45.     private $apropos;
  46.     public function __construct()
  47.     {
  48.         $this->avisConsultants = new ArrayCollection();
  49.         $this->comerciauxes = new ArrayCollection();
  50.         $this->service = new ArrayCollection();
  51.         $this->missions = new ArrayCollection();
  52.     }
  53.     //Sérialisation entreprise
  54.     public function __serialize(): array
  55.     {
  56.         $data parent::__serialize(); // Appeler la sérialisation de la classe parente
  57.         $data['nom'] = $this->nom
  58.         $data['prenom'] = $this->prenom
  59.         $data['raison_sociale'] = $this->raison_sociale
  60.         $data['ville'] = $this->ville
  61.         $data['cp'] = $this->cp
  62.         $data['adresse'] = $this->adresse
  63.         $data['fonction_entreprise'] = $this->fonction_entreprise
  64.         $data['apropos'] = $this->apropos
  65.         $data['numero_siret'] = $this->numero_siret
  66.         $data['genre'] = $this->genre
  67.         return $data;
  68.     }
  69.     // Dans la classe Consultant (la classe enfant)
  70.     public function __unserialize(array $data): void
  71.     {
  72.         parent::__unserialize($data); // Restaurer les données de la classe parente
  73.         $this->nom $data['nom'] ?? null
  74.         $this->prenom $data['prenom'] ?? null;
  75.         $this->raison_sociale $data['raison_sociale'] ?? null;
  76.         $this->ville $data['ville'] ?? null;
  77.         $this->cp $data['cp'] ?? null;
  78.         $this->adresse $data['adresse'] ?? null;
  79.         $this->fonction_entreprise $data['fonction_entreprise'] ?? null;
  80.         $this->apropos $data['apropos'] ?? null;
  81.         $this->numero_siret $data['numero_siret'] ?? null;
  82.         $this->genre $data['genre'] ?? null;
  83.     }
  84.     public function getRaisonSociale(): ?string
  85.     {
  86.         return $this->raison_sociale;
  87.     }
  88.     public function setRaisonSociale(string $raison_sociale): self
  89.     {
  90.         $this->raison_sociale $raison_sociale;
  91.         return $this;
  92.     }
  93.     public function getAdresse(): ?string
  94.     {
  95.         return $this->adresse;
  96.     }
  97.     public function setAdresse(string $adresse): self
  98.     {
  99.         $this->adresse $adresse;
  100.         return $this;
  101.     }
  102.     public function getVille(): ?string
  103.     {
  104.         return $this->ville;
  105.     }
  106.     public function setVille(string $ville): self
  107.     {
  108.         $this->ville $ville;
  109.         return $this;
  110.     }
  111.     public function getCp(): ?string
  112.     {
  113.         return $this->cp;
  114.     }
  115.     public function setCp(string $cp): self
  116.     {
  117.         $this->cp $cp;
  118.         return $this;
  119.     }
  120.     public function getNumeroSiret(): ?string
  121.     {
  122.         return $this->numero_siret;
  123.     }
  124.     public function setNumeroSiret(string $numero_siret): self
  125.     {
  126.         $this->numero_siret $numero_siret;
  127.         return $this;
  128.     }
  129.     public function getLogoEntreprise()
  130.     {
  131.         return $this->logo_entreprise;
  132.     }
  133.     public function setLogoEntreprise($logo_entreprise): self
  134.     {
  135.         $this->logo_entreprise $logo_entreprise;
  136.         return $this;
  137.     }
  138.     public function getFonctionEntreprise(): ?string
  139.     {
  140.         return $this->fonction_entreprise;
  141.     }
  142.     public function setFonctionEntreprise(?string $fonction_entreprise): self
  143.     {
  144.         $this->fonction_entreprise $fonction_entreprise;
  145.         return $this;
  146.     }
  147.     public function getNom(): ?string
  148.     {
  149.         return $this->nom;
  150.     }
  151.     public function setNom(string $nom): self
  152.     {
  153.         $this->nom $nom;
  154.         return $this;
  155.     }
  156.     public function getPrenom(): ?string
  157.     {
  158.         return $this->prenom;
  159.     }
  160.     public function setPrenom(string $prenom): self
  161.     {
  162.         $this->prenom $prenom;
  163.         return $this;
  164.     }
  165.     public function getGenre(): ?string
  166.     {
  167.         return $this->genre;
  168.     }
  169.     public function setGenre(string $genre): self
  170.     {
  171.         $this->genre $genre;
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection<int, AvisConsultant>
  176.      */
  177.     public function getAvisConsultants(): Collection
  178.     {
  179.         return $this->avisConsultants;
  180.     }
  181.     public function addAvisConsultant(AvisConsultant $avisConsultant): self
  182.     {
  183.         if (!$this->avisConsultants->contains($avisConsultant)) {
  184.             $this->avisConsultants[] = $avisConsultant;
  185.             $avisConsultant->setEntreprise($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeAvisConsultant(AvisConsultant $avisConsultant): self
  190.     {
  191.         if ($this->avisConsultants->removeElement($avisConsultant)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($avisConsultant->getEntreprise() === $this) {
  194.                 $avisConsultant->setEntreprise(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     /**
  200.      * @return Collection<int, Comerciaux>
  201.      */
  202.     public function getComerciauxes(): Collection
  203.     {
  204.         return $this->comerciauxes;
  205.     }
  206.     public function addComerciaux(Comerciaux $comerciaux): self
  207.     {
  208.         if (!$this->comerciauxes->contains($comerciaux)) {
  209.             $this->comerciauxes[] = $comerciaux;
  210.             $comerciaux->setEntreprise($this);
  211.         }
  212.         return $this;
  213.     }
  214.     public function removeComerciaux(Comerciaux $comerciaux): self
  215.     {
  216.         if ($this->comerciauxes->removeElement($comerciaux)) {
  217.             // set the owning side to null (unless already changed)
  218.             if ($comerciaux->getEntreprise() === $this) {
  219.                 $comerciaux->setEntreprise(null);
  220.             }
  221.         }
  222.         return $this;
  223.     }
  224.     public function getTypeEntreprise(): ?TypeEntreprise
  225.     {
  226.         return $this->type_entreprise;
  227.     }
  228.     public function setTypeEntreprise(?TypeEntreprise $type_entreprise): self
  229.     {
  230.         $this->type_entreprise $type_entreprise;
  231.         return $this;
  232.     }
  233.     /**
  234.      * @return Collection<int, Services>
  235.      */
  236.     public function getService(): Collection
  237.     {
  238.         return $this->service;
  239.     }
  240.     public function addService(Services $service): self
  241.     {
  242.         if (!$this->service->contains($service)) {
  243.             $this->service[] = $service;
  244.         }
  245.         return $this;
  246.     }
  247.     public function removeService(Services $service): self
  248.     {
  249.         $this->service->removeElement($service);
  250.         return $this;
  251.     }
  252.     /**
  253.      * @return Collection<int, Missions>
  254.      */
  255.     public function getMissions(): Collection
  256.     {
  257.         return $this->missions;
  258.     }
  259.     public function addMission(Missions $mission): self
  260.     {
  261.         if (!$this->missions->contains($mission)) {
  262.             $this->missions[] = $mission;
  263.             $mission->setEntreprise($this);
  264.         }
  265.         return $this;
  266.     }
  267.     public function removeMission(Missions $mission): self
  268.     {
  269.         if ($this->missions->removeElement($mission)) {
  270.             // set the owning side to null (unless already changed)
  271.             if ($mission->getEntreprise() === $this) {
  272.                 $mission->setEntreprise(null);
  273.             }
  274.         }
  275.         return $this;
  276.     }
  277.     public function getApropos(): ?string
  278.     {
  279.         return $this->apropos;
  280.     }
  281.     public function setApropos(?string $apropos): self
  282.     {
  283.         $this->apropos $apropos;
  284.         return $this;
  285.     }
  286. }