src/Entity/Societe.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SocieteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSocieteRepository::class)]
  8. class Societe
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length50)]
  15.     private ?string $name null;
  16.     #[ORM\Column(length25)]
  17.     private ?string $phone null;
  18.     #[ORM\Column(length50nullabletrue)]
  19.     private ?string $email null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $adress null;
  22.     #[ORM\ManyToMany(targetEntityLocataire::class, mappedBy'society')]
  23.     private Collection $locataires;
  24.     public function __construct()
  25.     {
  26.         $this->locataires = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getName(): ?string
  33.     {
  34.         return $this->name;
  35.     }
  36.     public function setName(string $name): static
  37.     {
  38.         $this->name $name;
  39.         return $this;
  40.     }
  41.     public function getPhone(): ?string
  42.     {
  43.         return $this->phone;
  44.     }
  45.     public function setPhone(string $phone): static
  46.     {
  47.         $this->phone $phone;
  48.         return $this;
  49.     }
  50.     public function getEmail(): ?string
  51.     {
  52.         return $this->email;
  53.     }
  54.     public function setEmail(?string $email): static
  55.     {
  56.         $this->email $email;
  57.         return $this;
  58.     }
  59.     public function getAdress(): ?string
  60.     {
  61.         return $this->adress;
  62.     }
  63.     public function setAdress(?string $adress): static
  64.     {
  65.         $this->adress $adress;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, Locataire>
  70.      */
  71.     public function getLocataires(): Collection
  72.     {
  73.         return $this->locataires;
  74.     }
  75.     public function addLocataire(Locataire $locataire): static
  76.     {
  77.         if (!$this->locataires->contains($locataire)) {
  78.             $this->locataires->add($locataire);
  79.             $locataire->addSociety($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeLocataire(Locataire $locataire): static
  84.     {
  85.         if ($this->locataires->removeElement($locataire)) {
  86.             $locataire->removeSociety($this);
  87.         }
  88.         return $this;
  89.     }
  90. }