<?php
namespace Uniski\ResourceBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table("address")
*/
class Address
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @var string
* @ORM\Column(name="city", type="string")
*/
protected $city;
/**
* @var string
* @ORM\Column(name="address", type="string")
*/
protected $address;
/**
* @var string
* @ORM\Column(name="country", type="string")
*/
protected $country;
/**
* @var array
* @ORM\Column(name="location", type="json", nullable=true)
*/
protected $location;
/**
* @var decimal
* @ORM\Column(type="float", precision=10, scale=6, nullable=true)
*/
protected $latitude;
/**
* @var decimal
* @ORM\Column(type="float", precision=10, scale=6, nullable=true)
*/
protected $longitude;
/**
* @var string
* @ORM\Column(name="postalCode", type="string", nullable=true)
*/
protected $postalCode;
function __construct(
$address,
$city,
$postalCode,
$country,
$latitude,
$longitude
)
{
$this->address = $address;
$this->city = $city;
$this->postalCode = $postalCode;
$this->country = $country;
$this->latitude = $latitude;
$this->longitude = $longitude;
}
/**
* Set city
*
* @param string $city
*
* @return Address
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set address
*
* @param string $address
*
* @return Address
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set country
*
* @param string $country
*
* @return Address
*/
public function setCountry($country)
{
$this->country = $country;
return $this;
}
/**
* Get country
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
/**
* Set location
*
* @param array $location
*
* @return Address
*/
public function setLocation($location)
{
$this->location = $location;
return $this;
}
/**
* Get location
*
* @return array
*/
public function getLocation()
{
return $this->location;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get latitude
*
* @return array
*/
public function getLatitude()
{
return $this->latitude;
}
/**
* Get longitude
*
* @return array
*/
public function getLongitude()
{
return $this->longitude;
}
public function hasCoordinates()
{
return !empty($this->longitude) &&
!empty($this->latitude);
}
/**
* @return string
*/
public function getPostalCode()
{
return $this->postalCode;
}
/**
* @param string $postalCode
*
* @return self
*/
public function setPostalCode($postalCode)
{
$this->postalCode = $postalCode;
return $this;
}
/**
* @param decimal $latitude
*
* @return self
*/
public function setLatitude($latitude)
{
$this->latitude = $latitude;
return $this;
}
/**
* @param decimal $longitude
*
* @return self
*/
public function setLongitude($longitude)
{
$this->longitude = $longitude;
return $this;
}
}