<?php
namespace App\Entity;
use App\Repository\CityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=CityRepository::class)
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
*/
class City extends BaseEntity
{
use SoftDeleteableEntity;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity=State::class, inversedBy="cities")
*/
private $state;
/**
* @ORM\Column(type="string", length=255)
*/
private $stateCode;
/**
* @ORM\ManyToOne(targetEntity=Country::class, inversedBy="cities")
*/
private $country;
/**
* @ORM\Column(type="string", length=2)
*/
private $countryCode;
/**
* @ORM\Column(type="decimal", precision=10, scale=8, nullable=true)
*/
private $latitude;
/**
* @ORM\Column(type="decimal", precision=11, scale=8, nullable=true)
*/
private $longitude;
/**
* @ORM\Column(type="binary", options={"default": 1})
*/
private $flag;
/**
* @ORM\Column(name="wikiDataId", type="string", length=255, nullable=true)
*/
private $wikiDataId;
/**
* @ORM\OneToMany(targetEntity=CustomerBilling::class, mappedBy="city")
*/
private $customerBillings;
public function __construct()
{
$this->customerBillings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getState(): ?State
{
return $this->state;
}
public function setState(?State $state): self
{
$this->state = $state;
return $this;
}
public function getStateCode(): ?string
{
return $this->stateCode;
}
public function setStateCode(string $stateCode): self
{
$this->stateCode = $stateCode;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getCountryCode(): ?string
{
return $this->countryCode;
}
public function setCountryCode(string $countryCode): self
{
$this->countryCode = $countryCode;
return $this;
}
public function getLatitude(): ?string
{
return $this->latitude;
}
public function setLatitude(?string $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?string
{
return $this->longitude;
}
public function setLongitude(?string $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getFlag()
{
return $this->flag;
}
public function setFlag($flag): self
{
$this->flag = $flag;
return $this;
}
public function getWikiDataId(): ?string
{
return $this->wikiDataId;
}
public function setWikiDataId(?string $wikiDataId): self
{
$this->wikiDataId = $wikiDataId;
return $this;
}
/**
* @return Collection<int, CustomerBilling>
*/
public function getCustomerBillings(): Collection
{
return $this->customerBillings;
}
public function addCustomerBilling(CustomerBilling $customerBilling): self
{
if (!$this->customerBillings->contains($customerBilling)) {
$this->customerBillings[] = $customerBilling;
$customerBilling->setCity($this);
}
return $this;
}
public function removeCustomerBilling(CustomerBilling $customerBilling): self
{
if ($this->customerBillings->removeElement($customerBilling)) {
// set the owning side to null (unless already changed)
if ($customerBilling->getCity() === $this) {
$customerBilling->setCity(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
}