src/Entity/Address.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddressRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassAddressRepository::class)]
  8. class Address
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $address_street null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $address_complementary null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $address_city null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $address_region null;
  22.     #[ORM\Column(length5)]
  23.     private ?string $address_postcode null;
  24.     #[ORM\Column(length10)]
  25.     private ?string $address_telephone null;
  26.     #[ORM\OneToMany(mappedBy'order_address'targetEntityOrder::class)]
  27.     private Collection $orders;
  28.     #[ORM\Column(length255)]
  29.     private ?string $address_name null;
  30.     #[ORM\Column(length255)]
  31.     private ?string $address_surname null;
  32.     public function __construct()
  33.     {
  34.         $this->orders = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getAddressStreet(): ?string
  41.     {
  42.         return $this->address_street;
  43.     }
  44.     public function setAddressStreet(string $address_street): self
  45.     {
  46.         $this->address_street $address_street;
  47.         return $this;
  48.     }
  49.     public function getAddressComplementary(): ?string
  50.     {
  51.         return $this->address_complementary;
  52.     }
  53.     public function setAddressComplementary(?string $address_complementary): self
  54.     {
  55.         $this->address_complementary $address_complementary;
  56.         return $this;
  57.     }
  58.     public function getAddressCity(): ?string
  59.     {
  60.         return $this->address_city;
  61.     }
  62.     public function setAddressCity(string $address_city): self
  63.     {
  64.         $this->address_city $address_city;
  65.         return $this;
  66.     }
  67.     public function getAddressRegion(): ?string
  68.     {
  69.         return $this->address_region;
  70.     }
  71.     public function setAddressRegion(string $address_region): self
  72.     {
  73.         $this->address_region $address_region;
  74.         return $this;
  75.     }
  76.     public function getAddressPostcode(): ?string
  77.     {
  78.         return $this->address_postcode;
  79.     }
  80.     public function setAddressPostcode(string $address_postcode): self
  81.     {
  82.         $this->address_postcode $address_postcode;
  83.         return $this;
  84.     }
  85.     public function getAddressTelephone(): ?string
  86.     {
  87.         return $this->address_telephone;
  88.     }
  89.     public function setAddressTelephone(string $address_telephone): self
  90.     {
  91.         $this->address_telephone $address_telephone;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @return Collection<int, Order>
  96.      */
  97.     public function getOrders(): Collection
  98.     {
  99.         return $this->orders;
  100.     }
  101.     public function addOrder(Order $order): self
  102.     {
  103.         if (!$this->orders->contains($order)) {
  104.             $this->orders->add($order);
  105.             $order->setOrderAddress($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeOrder(Order $order): self
  110.     {
  111.         if ($this->orders->removeElement($order)) {
  112.             // set the owning side to null (unless already changed)
  113.             if ($order->getOrderAddress() === $this) {
  114.                 $order->setOrderAddress(null);
  115.             }
  116.         }
  117.         return $this;
  118.     }
  119.     public function getAddressName(): ?string
  120.     {
  121.         return $this->address_name;
  122.     }
  123.     public function setAddressName(string $address_name): self
  124.     {
  125.         $this->address_name $address_name;
  126.         return $this;
  127.     }
  128.     public function getAddressSurname(): ?string
  129.     {
  130.         return $this->address_surname;
  131.     }
  132.     public function setAddressSurname(string $address_surname): self
  133.     {
  134.         $this->address_surname $address_surname;
  135.         return $this;
  136.     }
  137.     public function __toString(): string
  138.     {
  139.         return $this->address_name ' ' $this->address_surname ' ' $this->address_street ' ' $this->address_complementary ' ' $this->address_city ' ' $this->address_region ' ' $this->address_postcode ' ' $this->address_telephone;
  140.     }
  141. }