src/Entity/Address.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddressRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass=AddressRepository::class)
  8.  */
  9. class Address
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="addresses")
  19.      */
  20.     private $user;
  21.     /**
  22.      * @ORM\Column(type="string", length=128)
  23.      */
  24.     private $country;
  25.     /**
  26.      * @ORM\Column(type="string", length=128)
  27.      */
  28.     private $city;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $address;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $address2;
  37.     /**
  38.      * @ORM\Column(type="string", length=64, nullable=true)
  39.      */
  40.     private $box;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $zip;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      * @Assert\Length(min = 8, max = 30, minMessage = "min_lenght", maxMessage = "max_lenght")
  48.      */
  49.     private $phone;
  50.     /**
  51.      * @ORM\Column(type="string", length=255)
  52.      */
  53.     private $name;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, nullable=true)
  56.      */
  57.     private $email;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      */
  61.     private $firstname;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $lastname;
  66.     public function __toString() {
  67.         return $this->getName();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getUser(): ?User
  74.     {
  75.         return $this->user;
  76.     }
  77.     public function setUser(?User $user): self
  78.     {
  79.         $this->user $user;
  80.         return $this;
  81.     }
  82.     public function getCountry(): ?string
  83.     {
  84.         return $this->country;
  85.     }
  86.     public function setCountry(string $country): self
  87.     {
  88.         $this->country $country;
  89.         return $this;
  90.     }
  91.     public function getCity(): ?string
  92.     {
  93.         return $this->city;
  94.     }
  95.     public function setCity(string $city): self
  96.     {
  97.         $this->city $city;
  98.         return $this;
  99.     }
  100.     public function getAddress(): ?string
  101.     {
  102.         return $this->address;
  103.     }
  104.     public function setAddress(string $address): self
  105.     {
  106.         $this->address $address;
  107.         return $this;
  108.     }
  109.     public function getAddress2(): ?string
  110.     {
  111.         return $this->address2;
  112.     }
  113.     public function setAddress2(string $address2): self
  114.     {
  115.         $this->address2 $address2;
  116.         return $this;
  117.     }
  118.     public function getBox(): ?string
  119.     {
  120.         return $this->box;
  121.     }
  122.     public function setBox(string $box): self
  123.     {
  124.         $this->box $box;
  125.         return $this;
  126.     }
  127.     public function getZip(): ?string
  128.     {
  129.         return $this->zip;
  130.     }
  131.     public function setZip(string $zip): self
  132.     {
  133.         $this->zip $zip;
  134.         return $this;
  135.     }
  136.     public function getPhone(): ?string
  137.     {
  138.         return $this->phone;
  139.     }
  140.     public function setPhone(string $phone): self
  141.     {
  142.         $this->phone $phone;
  143.         return $this;
  144.     }
  145.     public function getName(): ?string
  146.     {
  147.         return $this->name;
  148.     }
  149.     public function setName(string $name): self
  150.     {
  151.         $this->name $name;
  152.         return $this;
  153.     }
  154.     public function getEmail(): ?string
  155.     {
  156.         return $this->email;
  157.     }
  158.     public function setEmail(string $email): self
  159.     {
  160.         $this->email $email;
  161.         return $this;
  162.     }
  163.     public function getFirstname(): ?string
  164.     {
  165.         return $this->firstname;
  166.     }
  167.     public function setFirstname(string $firstname): self
  168.     {
  169.         $this->firstname $firstname;
  170.         return $this;
  171.     }
  172.     public function getLastname(): ?string
  173.     {
  174.         return $this->lastname;
  175.     }
  176.     public function setLastname(string $lastname): self
  177.     {
  178.         $this->lastname $lastname;
  179.         return $this;
  180.     }
  181. }