src/Entity/BillingAddress.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BillingAddressRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassBillingAddressRepository::class)]
  8. class BillingAddress
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $billing_name null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $billing_surname null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $billing_street null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $billing_complementary null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $billing_city null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $billing_region null;
  26.     #[ORM\Column(length5)]
  27.     private ?string $billing_postcode null;
  28.     #[ORM\Column(length10)]
  29.     private ?string $billing_telephone null;
  30.     #[ORM\OneToMany(mappedBy'order_billing_address'targetEntityOrder::class)]
  31.     private Collection $orders;
  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 getBillingName(): ?string
  41.     {
  42.         return $this->billing_name;
  43.     }
  44.     public function setBillingName(string $billing_name): self
  45.     {
  46.         $this->billing_name $billing_name;
  47.         return $this;
  48.     }
  49.     public function getBillingSurname(): ?string
  50.     {
  51.         return $this->billing_surname;
  52.     }
  53.     public function setBillingSurname(string $billing_surname): self
  54.     {
  55.         $this->billing_surname $billing_surname;
  56.         return $this;
  57.     }
  58.     public function getBillingStreet(): ?string
  59.     {
  60.         return $this->billing_street;
  61.     }
  62.     public function setBillingStreet(string $billing_street): self
  63.     {
  64.         $this->billing_street $billing_street;
  65.         return $this;
  66.     }
  67.     public function getBillingComplementary(): ?string
  68.     {
  69.         return $this->billing_complementary;
  70.     }
  71.     public function setBillingComplementary(?string $billing_complementary): self
  72.     {
  73.         $this->billing_complementary $billing_complementary;
  74.         return $this;
  75.     }
  76.     public function getBillingCity(): ?string
  77.     {
  78.         return $this->billing_city;
  79.     }
  80.     public function setBillingCity(string $billing_city): self
  81.     {
  82.         $this->billing_city $billing_city;
  83.         return $this;
  84.     }
  85.     public function getBillingRegion(): ?string
  86.     {
  87.         return $this->billing_region;
  88.     }
  89.     public function setBillingRegion(string $billing_region): self
  90.     {
  91.         $this->billing_region $billing_region;
  92.         return $this;
  93.     }
  94.     public function getBillingPostcode(): ?string
  95.     {
  96.         return $this->billing_postcode;
  97.     }
  98.     public function setBillingPostcode(string $billing_postcode): self
  99.     {
  100.         $this->billing_postcode $billing_postcode;
  101.         return $this;
  102.     }
  103.     public function getBillingTelephone(): ?string
  104.     {
  105.         return $this->billing_telephone;
  106.     }
  107.     public function setBillingTelephone(string $billing_telephone): self
  108.     {
  109.         $this->billing_telephone $billing_telephone;
  110.         return $this;
  111.     }
  112.     /**
  113.      * @return Collection<int, Order>
  114.      */
  115.     public function getOrders(): Collection
  116.     {
  117.         return $this->orders;
  118.     }
  119.     public function addOrder(Order $order): self
  120.     {
  121.         if (!$this->orders->contains($order)) {
  122.             $this->orders->add($order);
  123.             $order->setOrderBillingAddress($this);
  124.         }
  125.         return $this;
  126.     }
  127.     public function removeOrder(Order $order): self
  128.     {
  129.         if ($this->orders->removeElement($order)) {
  130.             // set the owning side to null (unless already changed)
  131.             if ($order->getOrderBillingAddress() === $this) {
  132.                 $order->setOrderBillingAddress(null);
  133.             }
  134.         }
  135.         return $this;
  136.     }
  137.     public function __toString(): string
  138.     {
  139.         return $this->billing_name ' ' $this->billing_surname ' ' $this->billing_street ' ' $this->billing_complementary ' ' $this->billing_city ' ' $this->billing_region ' ' $this->billing_postcode ' ' $this->billing_telephone;
  140.     }
  141. }