src/Entity/Adresse.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AdressRepository;
  4. // Bdd map
  5. use Doctrine\ORM\Mapping as ORM;
  6. // Vérification pour formulaires
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Entity(repositoryClassAdressRepository::class)]
  9. #[ORM\Table(name'adresses')]
  10. class Adresse
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue(strategy'AUTO')]
  14.     //option "unsigne" que int positifs
  15.     #[ORM\Column(type'integer'options: ['unsigned' => true])]
  16.     private ?int $id null;
  17.     #[Assert\NotBlank(message'Le corps de l\'adresse est obligatoire !')]
  18.     #[ORM\Column(name'corps_adresse'type'string'length255)]
  19.     private ?string $corpsAdresse null;
  20.     #[Assert\NotBlank(message'Le code postal de l\'adresse est obligatoire !')]
  21.     #[ORM\Column(name'code_postal',type'string'length32)]
  22.     private ?string $codePostal null;
  23.     #[Assert\NotBlank(message'La ville est obligatoire !')]
  24.     #[ORM\Column(name:'ville'type'string'length120)]
  25.     private ?string $ville null;
  26.     #[ORM\Column(length50)]
  27.     private ?string $pays null;
  28.     // TODO ajouter département?
  29.     public function __toString(): string
  30.     {
  31.         return printf("%s<br>%s %s<br> %s" ,
  32.             $this->corpsAdresse$this->codePostalstrtoupper($this->ville) , strtoupper($this->pays));
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getCorpsAdresse(): ?string
  39.     {
  40.         return $this->corpsAdresse;
  41.     }
  42.     public function setCorpsAdresse(string $label): void
  43.     {
  44.         $this->corpsAdresse $label;
  45.     }
  46.     public function getCodePostal(): ?string
  47.     {
  48.         return $this->codePostal;
  49.     }
  50.     public function setCodePostal(string $postalCode): void
  51.     {
  52.         $this->codePostal $postalCode;
  53.     }
  54.     public function getVille(): ?string
  55.     {
  56.         return $this->ville;
  57.     }
  58.     public function setVille(string $city): void
  59.     {
  60.         $this->ville $city;
  61.     }
  62.     public function getUser(): ?User
  63.     {
  64.         return $this->user;
  65.     }
  66.     public function setUser(User $user): void
  67.     {
  68.         // set the owning side of the relation if necessary
  69.         if ($user->getAdresse() !== $this) {
  70.             $user->setAdresse($this);
  71.         }
  72.         $this->user $user;
  73.     }
  74.     public function getPays(): ?string
  75.     {
  76.         return $this->pays;
  77.     }
  78.     public function setPays(string $pays): void
  79.     {
  80.         $this->pays $pays;
  81.     }
  82. }