<?php
namespace App\Entity;
use App\Repository\EntreprisesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EntreprisesRepository::class)]
class Entreprises extends User
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer")]
private $id;
#[ORM\Column(type: 'string', length: 50)]
private $raison_sociale;
#[ORM\Column(type: 'string', length: 50)]
private $adresse;
#[ORM\Column(type: 'string', length: 50)]
private $ville;
#[ORM\Column(type: 'string', length: 50)]
private $cp;
#[ORM\Column(type: 'string', length: 50)]
private $numero_siret;
#[ORM\Column(type: 'blob', nullable: true)]
private $logo_entreprise;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private $fonction_entreprise;
#[ORM\Column(type: 'string', length: 50)]
private $nom;
#[ORM\Column(type: 'string', length: 50)]
private $prenom;
#[ORM\Column(type: 'string', length: 50)]
private $genre;
#[ORM\OneToMany(mappedBy: 'entreprise', targetEntity: AvisConsultant::class)]
private $avisConsultants;
#[ORM\OneToMany(mappedBy: 'entreprise', targetEntity: Comerciaux::class)]
private $comerciauxes;
#[ORM\ManyToOne(targetEntity: TypeEntreprise::class, inversedBy: 'entreprises')]
private $type_entreprise;
#[ORM\ManyToMany(targetEntity: Services::class, inversedBy: 'entreprises')]
private $service;
#[ORM\OneToMany(mappedBy: 'entreprise', targetEntity: Missions::class)]
private $missions;
#[ORM\Column(type: 'text', nullable: true)]
private $apropos;
public function __construct()
{
$this->avisConsultants = new ArrayCollection();
$this->comerciauxes = new ArrayCollection();
$this->service = new ArrayCollection();
$this->missions = new ArrayCollection();
}
//Sérialisation entreprise
public function __serialize(): array
{
$data = parent::__serialize(); // Appeler la sérialisation de la classe parente
$data['nom'] = $this->nom;
$data['prenom'] = $this->prenom;
$data['raison_sociale'] = $this->raison_sociale;
$data['ville'] = $this->ville;
$data['cp'] = $this->cp;
$data['adresse'] = $this->adresse;
$data['fonction_entreprise'] = $this->fonction_entreprise;
$data['apropos'] = $this->apropos;
$data['numero_siret'] = $this->numero_siret;
$data['genre'] = $this->genre;
return $data;
}
// Dans la classe Consultant (la classe enfant)
public function __unserialize(array $data): void
{
parent::__unserialize($data); // Restaurer les données de la classe parente
$this->nom = $data['nom'] ?? null;
$this->prenom = $data['prenom'] ?? null;
$this->raison_sociale = $data['raison_sociale'] ?? null;
$this->ville = $data['ville'] ?? null;
$this->cp = $data['cp'] ?? null;
$this->adresse = $data['adresse'] ?? null;
$this->fonction_entreprise = $data['fonction_entreprise'] ?? null;
$this->apropos = $data['apropos'] ?? null;
$this->numero_siret = $data['numero_siret'] ?? null;
$this->genre = $data['genre'] ?? null;
}
public function getRaisonSociale(): ?string
{
return $this->raison_sociale;
}
public function setRaisonSociale(string $raison_sociale): self
{
$this->raison_sociale = $raison_sociale;
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 getCp(): ?string
{
return $this->cp;
}
public function setCp(string $cp): self
{
$this->cp = $cp;
return $this;
}
public function getNumeroSiret(): ?string
{
return $this->numero_siret;
}
public function setNumeroSiret(string $numero_siret): self
{
$this->numero_siret = $numero_siret;
return $this;
}
public function getLogoEntreprise()
{
return $this->logo_entreprise;
}
public function setLogoEntreprise($logo_entreprise): self
{
$this->logo_entreprise = $logo_entreprise;
return $this;
}
public function getFonctionEntreprise(): ?string
{
return $this->fonction_entreprise;
}
public function setFonctionEntreprise(?string $fonction_entreprise): self
{
$this->fonction_entreprise = $fonction_entreprise;
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 getGenre(): ?string
{
return $this->genre;
}
public function setGenre(string $genre): self
{
$this->genre = $genre;
return $this;
}
/**
* @return Collection<int, AvisConsultant>
*/
public function getAvisConsultants(): Collection
{
return $this->avisConsultants;
}
public function addAvisConsultant(AvisConsultant $avisConsultant): self
{
if (!$this->avisConsultants->contains($avisConsultant)) {
$this->avisConsultants[] = $avisConsultant;
$avisConsultant->setEntreprise($this);
}
return $this;
}
public function removeAvisConsultant(AvisConsultant $avisConsultant): self
{
if ($this->avisConsultants->removeElement($avisConsultant)) {
// set the owning side to null (unless already changed)
if ($avisConsultant->getEntreprise() === $this) {
$avisConsultant->setEntreprise(null);
}
}
return $this;
}
/**
* @return Collection<int, Comerciaux>
*/
public function getComerciauxes(): Collection
{
return $this->comerciauxes;
}
public function addComerciaux(Comerciaux $comerciaux): self
{
if (!$this->comerciauxes->contains($comerciaux)) {
$this->comerciauxes[] = $comerciaux;
$comerciaux->setEntreprise($this);
}
return $this;
}
public function removeComerciaux(Comerciaux $comerciaux): self
{
if ($this->comerciauxes->removeElement($comerciaux)) {
// set the owning side to null (unless already changed)
if ($comerciaux->getEntreprise() === $this) {
$comerciaux->setEntreprise(null);
}
}
return $this;
}
public function getTypeEntreprise(): ?TypeEntreprise
{
return $this->type_entreprise;
}
public function setTypeEntreprise(?TypeEntreprise $type_entreprise): self
{
$this->type_entreprise = $type_entreprise;
return $this;
}
/**
* @return Collection<int, Services>
*/
public function getService(): Collection
{
return $this->service;
}
public function addService(Services $service): self
{
if (!$this->service->contains($service)) {
$this->service[] = $service;
}
return $this;
}
public function removeService(Services $service): self
{
$this->service->removeElement($service);
return $this;
}
/**
* @return Collection<int, Missions>
*/
public function getMissions(): Collection
{
return $this->missions;
}
public function addMission(Missions $mission): self
{
if (!$this->missions->contains($mission)) {
$this->missions[] = $mission;
$mission->setEntreprise($this);
}
return $this;
}
public function removeMission(Missions $mission): self
{
if ($this->missions->removeElement($mission)) {
// set the owning side to null (unless already changed)
if ($mission->getEntreprise() === $this) {
$mission->setEntreprise(null);
}
}
return $this;
}
public function getApropos(): ?string
{
return $this->apropos;
}
public function setApropos(?string $apropos): self
{
$this->apropos = $apropos;
return $this;
}
}