src/Entity/Address.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Validator as AppAssert;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Embeddable
  8.  */
  9. class Address
  10. {
  11.     /**
  12.      * @var string
  13.      *
  14.      * @ORM\Column(type="string", length=255, nullable=true)
  15.      * @Assert\Length(max="255")
  16.      * @Assert\NotBlank()
  17.      * @AppAssert\Geocodable()
  18.      */
  19.     private $request;
  20.     /**
  21.      * @var string
  22.      *
  23.      * @ORM\Column(type="json", nullable=true)
  24.      */
  25.     private $response;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      * @Assert\Length(max="255")
  31.      */
  32.     private $number;
  33.     /**
  34.      * @var string
  35.      *
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      * @Assert\Length(max="255")
  38.      */
  39.     private $street;
  40.     /**
  41.      * @var string
  42.      *
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      * @Assert\Length(max="255")
  45.      */
  46.     private $city;
  47.     /**
  48.      * @var string
  49.      *
  50.      * @ORM\Column(type="string", length=255, nullable=true)
  51.      * @Assert\Length(max="255")
  52.      */
  53.     private $administrativeLevel1Short;
  54.     /**
  55.      * @var string
  56.      *
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      * @Assert\Length(max="255")
  59.      */
  60.     private $administrativeLevel1Long;
  61.     /**
  62.      * @var string
  63.      *
  64.      * @ORM\Column(type="string", length=255, nullable=true)
  65.      * @Assert\Length(max="255")
  66.      */
  67.     private $administrativeLevel2;
  68.     /**
  69.      * @var string
  70.      *
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      * @Assert\Length(max="255")
  73.      */
  74.     private $countryShort;
  75.     /**
  76.      * @var string
  77.      *
  78.      * @ORM\Column(type="string", length=255, nullable=true)
  79.      * @Assert\Length(max="255")
  80.      */
  81.     private $countryLong;
  82.     /**
  83.      * @var string
  84.      *
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      * @Assert\Length(max="255")
  87.      */
  88.     private $postalCode;
  89.     /**
  90.      * @var string
  91.      *
  92.      * @ORM\Column(type="decimal", precision=11, scale=7, nullable=true)
  93.      */
  94.     private $latitude;
  95.     /**
  96.      * @var string
  97.      *
  98.      * @ORM\Column(type="decimal", precision=11, scale=7, nullable=true)
  99.      */
  100.     private $longitude;
  101.     public function clean()
  102.     {
  103.         $this->request null;
  104.         $this->response null;
  105.         $this->number null;
  106.         $this->street null;
  107.         $this->city null;
  108.         $this->administrativeLevel1Short null;
  109.         $this->administrativeLevel1Long null;
  110.         $this->administrativeLevel2 null;
  111.         $this->countryShort null;
  112.         $this->countryLong null;
  113.         $this->postalCode null;
  114.         $this->latitude null;
  115.         $this->longitude null;
  116.         return $this;
  117.     }
  118.     public function getRequest(): ?string
  119.     {
  120.         return $this->request;
  121.     }
  122.     public function setRequest(?string $request): self
  123.     {
  124.         $this->request $request;
  125.         return $this;
  126.     }
  127.     public function getResponse()
  128.     {
  129.         return $this->response;
  130.     }
  131.     public function setResponse($response): self
  132.     {
  133.         $this->response $response;
  134.         return $this;
  135.     }
  136.     public function getNumber(): ?string
  137.     {
  138.         return $this->number;
  139.     }
  140.     public function setNumber(?string $number): self
  141.     {
  142.         $this->number $number;
  143.         return $this;
  144.     }
  145.     public function getStreet(): ?string
  146.     {
  147.         return $this->street;
  148.     }
  149.     public function setStreet(?string $street): self
  150.     {
  151.         $this->street $street;
  152.         return $this;
  153.     }
  154.     public function getCity(): ?string
  155.     {
  156.         return $this->city;
  157.     }
  158.     public function setCity(?string $city): self
  159.     {
  160.         $this->city $city;
  161.         return $this;
  162.     }
  163.     public function getAdministrativeLevel1Short(): ?string
  164.     {
  165.         return $this->administrativeLevel1Short;
  166.     }
  167.     public function setAdministrativeLevel1Short(?string $administrativeLevel1Short): self
  168.     {
  169.         $this->administrativeLevel1Short $administrativeLevel1Short;
  170.         return $this;
  171.     }
  172.     public function getAdministrativeLevel1Long(): ?string
  173.     {
  174.         return $this->administrativeLevel1Long;
  175.     }
  176.     public function setAdministrativeLevel1Long(?string $administrativeLevel1Long): self
  177.     {
  178.         $this->administrativeLevel1Long $administrativeLevel1Long;
  179.         return $this;
  180.     }
  181.     public function getAdministrativeLevel2(): ?string
  182.     {
  183.         return $this->administrativeLevel2;
  184.     }
  185.     public function setAdministrativeLevel2(?string $administrativeLevel2): self
  186.     {
  187.         $this->administrativeLevel2 $administrativeLevel2;
  188.         return $this;
  189.     }
  190.     public function getCountryShort(): ?string
  191.     {
  192.         return $this->countryShort;
  193.     }
  194.     public function setCountryShort(?string $countryShort): self
  195.     {
  196.         $this->countryShort $countryShort;
  197.         return $this;
  198.     }
  199.     public function getCountryLong(): ?string
  200.     {
  201.         return $this->countryLong;
  202.     }
  203.     public function setCountryLong(?string $countryLong): self
  204.     {
  205.         $this->countryLong $countryLong;
  206.         return $this;
  207.     }
  208.     public function getPostalCode(): ?string
  209.     {
  210.         return $this->postalCode;
  211.     }
  212.     public function setPostalCode(?string $postalCode): self
  213.     {
  214.         $this->postalCode $postalCode;
  215.         return $this;
  216.     }
  217.     public function getLatitude()
  218.     {
  219.         return $this->latitude;
  220.     }
  221.     public function setLatitude($latitude): self
  222.     {
  223.         $this->latitude $latitude;
  224.         return $this;
  225.     }
  226.     public function getLongitude()
  227.     {
  228.         return $this->longitude;
  229.     }
  230.     public function setLongitude($longitude): self
  231.     {
  232.         $this->longitude $longitude;
  233.         return $this;
  234.     }
  235.     /**
  236.      * Return true if all properties == null|[].
  237.      *
  238.      * @return bool
  239.      */
  240.     public function isNull()
  241.     {
  242.         return empty(array_filter(get_object_vars($this)));
  243.     }
  244.     public function __toString(): string
  245.     {
  246.         $parts = [];
  247.         if (null !== $this->city) {
  248.             $parts[] = $this->city;
  249.         }
  250.         if (null !== $this->administrativeLevel1Short) {
  251.             $parts[] = $this->administrativeLevel1Short;
  252.         }
  253.         return implode(', '$parts);
  254.     }
  255. }