src/Uniski/ResourceBundle/Entity/Address.php line 11

Open in your IDE?
  1. <?php
  2. namespace Uniski\ResourceBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * @ORM\Entity
  6. * @ORM\Table("address")
  7. */
  8. class Address
  9. {
  10.   /**
  11.    * @var integer
  12.    *
  13.    * @ORM\Id
  14.    * @ORM\Column(name="id", type="integer")
  15.    * @ORM\GeneratedValue(strategy="IDENTITY")
  16.    */
  17.   protected $id;
  18.   /**
  19.    * @var  string
  20.    * @ORM\Column(name="city", type="string")
  21.    */
  22.   protected $city;
  23.   /**
  24.    * @var  string
  25.    * @ORM\Column(name="address", type="string")
  26.    */
  27.   protected $address;
  28.   /**
  29.    * @var  string
  30.    * @ORM\Column(name="country", type="string")
  31.    */
  32.   protected $country;
  33.   /**
  34.    * @var  array
  35.    * @ORM\Column(name="location", type="json", nullable=true)
  36.    */
  37.   protected $location;
  38.     /**
  39.    * @var  decimal 
  40.    * @ORM\Column(type="float", precision=10, scale=6, nullable=true)
  41.    */
  42.   protected $latitude;
  43.     /**
  44.    * @var  decimal
  45.    * @ORM\Column(type="float", precision=10, scale=6, nullable=true)
  46.    */
  47.   protected $longitude;
  48.   /**
  49.    * @var  string
  50.    * @ORM\Column(name="postalCode", type="string", nullable=true)
  51.    */
  52.   protected $postalCode;
  53.   function __construct(
  54.     $address,
  55.     $city,
  56.     $postalCode,
  57.     $country,
  58.     $latitude,
  59.     $longitude
  60.   )
  61.   {
  62.     $this->address $address;
  63.     $this->city $city;
  64.     $this->postalCode $postalCode;
  65.     $this->country $country;
  66.     $this->latitude $latitude;
  67.     $this->longitude $longitude;
  68.   }
  69.     /**
  70.      * Set city
  71.      *
  72.      * @param string $city
  73.      *
  74.      * @return Address
  75.      */
  76.     public function setCity($city)
  77.     {
  78.         $this->city $city;
  79.         return $this;
  80.     }
  81.     /**
  82.      * Get city
  83.      *
  84.      * @return string
  85.      */
  86.     public function getCity()
  87.     {
  88.         return $this->city;
  89.     }
  90.     /**
  91.      * Set address
  92.      *
  93.      * @param string $address
  94.      *
  95.      * @return Address
  96.      */
  97.     public function setAddress($address)
  98.     {
  99.         $this->address $address;
  100.         return $this;
  101.     }
  102.     /**
  103.      * Get address
  104.      *
  105.      * @return string
  106.      */
  107.     public function getAddress()
  108.     {
  109.         return $this->address;
  110.     }
  111.     /**
  112.      * Set country
  113.      *
  114.      * @param string $country
  115.      *
  116.      * @return Address
  117.      */
  118.     public function setCountry($country)
  119.     {
  120.         $this->country $country;
  121.         return $this;
  122.     }
  123.     /**
  124.      * Get country
  125.      *
  126.      * @return string
  127.      */
  128.     public function getCountry()
  129.     {
  130.         return $this->country;
  131.     }
  132.     /**
  133.      * Set location
  134.      *
  135.      * @param array $location
  136.      *
  137.      * @return Address
  138.      */
  139.     public function setLocation($location)
  140.     {
  141.         $this->location $location;
  142.         return $this;
  143.     }
  144.     /**
  145.      * Get location
  146.      *
  147.      * @return array
  148.      */
  149.     public function getLocation()
  150.     {
  151.         return $this->location;
  152.     }
  153.     /**
  154.      * Get id
  155.      *
  156.      * @return integer
  157.      */
  158.     public function getId()
  159.     {
  160.         return $this->id;
  161.     }
  162.     /**
  163.      * Get latitude
  164.      *
  165.      * @return array
  166.      */
  167.     public function getLatitude()
  168.     {
  169.       return $this->latitude;
  170.     }
  171.     /**
  172.      * Get longitude
  173.      *
  174.      * @return array
  175.      */
  176.     public function getLongitude()
  177.     {
  178.       return $this->longitude;
  179.     }
  180.     public function hasCoordinates()
  181.     {
  182.       return !empty($this->longitude) &&
  183.              !empty($this->latitude);
  184.     }
  185.     /**
  186.      * @return  string
  187.      */
  188.     public function getPostalCode()
  189.     {
  190.         return $this->postalCode;
  191.     }
  192.     /**
  193.      * @param  string $postalCode
  194.      *
  195.      * @return self
  196.      */
  197.     public function setPostalCode($postalCode)
  198.     {
  199.         $this->postalCode $postalCode;
  200.         return $this;
  201.     }
  202.     /**
  203.      * @param  decimal $latitude
  204.      *
  205.      * @return self
  206.      */
  207.     public function setLatitude($latitude)
  208.     {
  209.         $this->latitude $latitude;
  210.         return $this;
  211.     }
  212.     /**
  213.      * @param  decimal $longitude
  214.      *
  215.      * @return self
  216.      */
  217.     public function setLongitude($longitude)
  218.     {
  219.         $this->longitude $longitude;
  220.         return $this;
  221.     }
  222. }