src/Entity/Addresse.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddresseRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassAddresseRepository::class)]
  6. class Addresse
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private ?int $id null;
  12.     #[ORM\Column(nullabletrue)]
  13.     private ?bool $default_addresse null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $full_addresse null;
  16.     #[ORM\Column(nullabletrue)]
  17.     private ?int $code_postale null;
  18.     #[ORM\Column(length150nullabletrue)]
  19.     private ?string $ville null;
  20.     #[ORM\Column(length50nullabletrue)]
  21.     private ?string $label null;
  22.     // ── extra address-detail fields (restored to match the live DB) ──
  23.     #[ORM\Column(length20nullabletrue)]
  24.     private ?string $floor null;
  25.     #[ORM\Column(length30nullabletrue)]
  26.     private ?string $apartment null;
  27.     #[ORM\Column(length100nullabletrue)]
  28.     private ?string $contact_person null;
  29.     #[ORM\Column(length30nullabletrue)]
  30.     private ?string $contact_phone null;
  31.     // ── geographic hierarchy: Country → Region → City ──
  32.     // region is what drives the per-shop delivery-fee lookup at checkout.
  33.     #[ORM\ManyToOne(targetEntityCountry::class)]
  34.     #[ORM\JoinColumn(name'country_id'referencedColumnName'id'nullabletrueonDelete'SET NULL')]
  35.     private ?Country $country null;
  36.     #[ORM\ManyToOne(targetEntityRegion::class)]
  37.     #[ORM\JoinColumn(name'region_id'referencedColumnName'id'nullabletrueonDelete'SET NULL')]
  38.     private ?Region $region null;
  39.     #[ORM\ManyToOne(targetEntityCity::class)]
  40.     #[ORM\JoinColumn(name'city_id'referencedColumnName'id'nullabletrueonDelete'SET NULL')]
  41.     private ?City $city null;
  42.     #[ORM\ManyToOne(inversedBy'addresses')]
  43.     private ?User $user null;
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function setId(int $id): self
  49.     {
  50.         return $this;
  51.     }
  52.     public function isDefaultAddresse(): ?bool
  53.     {
  54.         return $this->default_addresse;
  55.     }
  56.     public function setDefaultAddresse(?bool $default_addresse): self
  57.     {
  58.         $this->default_addresse $default_addresse;
  59.         return $this;
  60.     }
  61.     public function getFullAddresse(): ?string
  62.     {
  63.         return $this->full_addresse;
  64.     }
  65.     public function setFullAddresse(string $full_addresse): self
  66.     {
  67.         $this->full_addresse $full_addresse;
  68.         return $this;
  69.     }
  70.     public function getCodePostale(): ?int
  71.     {
  72.         return $this->code_postale;
  73.     }
  74.     public function setCodePostale(?int $code_postale): self
  75.     {
  76.         $this->code_postale $code_postale;
  77.         return $this;
  78.     }
  79.     public function getVille(): ?string
  80.     {
  81.         return $this->ville;
  82.     }
  83.     public function setVille(string $ville): self
  84.     {
  85.         $this->ville $ville;
  86.         return $this;
  87.     }
  88.     public function getLabel(): ?string
  89.     {
  90.         return $this->label;
  91.     }
  92.     public function setLabel(?string $label): self
  93.     {
  94.         $this->label $label;
  95.         return $this;
  96.     }
  97.     public function getLabelIcon(): string
  98.     {
  99.         return match($this->label) {
  100.             'Home'    => '🏠',
  101.             'Work'    => '💼',
  102.             'Hangout' => '🎯',
  103.             default   => '📍',
  104.         };
  105.     }
  106.     public function getFloor(): ?string
  107.     {
  108.         return $this->floor;
  109.     }
  110.     public function setFloor(?string $floor): self
  111.     {
  112.         $this->floor $floor;
  113.         return $this;
  114.     }
  115.     public function getApartment(): ?string
  116.     {
  117.         return $this->apartment;
  118.     }
  119.     public function setApartment(?string $apartment): self
  120.     {
  121.         $this->apartment $apartment;
  122.         return $this;
  123.     }
  124.     public function getContactPerson(): ?string
  125.     {
  126.         return $this->contact_person;
  127.     }
  128.     public function setContactPerson(?string $contact_person): self
  129.     {
  130.         $this->contact_person $contact_person;
  131.         return $this;
  132.     }
  133.     public function getContactPhone(): ?string
  134.     {
  135.         return $this->contact_phone;
  136.     }
  137.     public function setContactPhone(?string $contact_phone): self
  138.     {
  139.         $this->contact_phone $contact_phone;
  140.         return $this;
  141.     }
  142.     public function getCountry(): ?Country
  143.     {
  144.         return $this->country;
  145.     }
  146.     public function setCountry(?Country $country): self
  147.     {
  148.         $this->country $country;
  149.         return $this;
  150.     }
  151.     public function getRegion(): ?Region
  152.     {
  153.         return $this->region;
  154.     }
  155.     public function setRegion(?Region $region): self
  156.     {
  157.         $this->region $region;
  158.         return $this;
  159.     }
  160.     public function getCity(): ?City
  161.     {
  162.         return $this->city;
  163.     }
  164.     public function setCity(?City $city): self
  165.     {
  166.         $this->city $city;
  167.         return $this;
  168.     }
  169.     public function getUser(): ?User
  170.     {
  171.         return $this->user;
  172.     }
  173.     public function setUser(?User $user): self
  174.     {
  175.         $this->user $user;
  176.         return $this;
  177.     }
  178. }