<?php
namespace App\Entity;
use App\Repository\StateRepository;
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=StateRepository::class)
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
*/
class State 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=country::class, inversedBy="countryCode")
*/
private $country;
/**
* @ORM\Column(type="string", length=2)
*/
private $countryCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fipsCode;
/**
* @ORM\Column(type="string", length=2, nullable=true)
*/
private $iso2;
/**
* @ORM\Column(type="string", length=191, nullable=true)
*/
private $type;
/**
* @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=City::class, mappedBy="State")
*/
private $cities;
/**
* @ORM\OneToMany(targetEntity=CustomerBilling::class, mappedBy="State")
*/
private $customerBillings;
public function __construct()
{
$this->cities = new ArrayCollection();
$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 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 getFipsCode(): ?string
{
return $this->fipsCode;
}
public function setFipsCode(?string $fipsCode): self
{
$this->fipsCode = $fipsCode;
return $this;
}
public function getIso2(): ?string
{
return $this->iso2;
}
public function setIso2(?string $iso2): self
{
$this->iso2 = $iso2;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
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, City>
*/
public function getCities(): Collection
{
return $this->cities;
}
public function addCity(City $city): self
{
if (!$this->cities->contains($city)) {
$this->cities[] = $city;
$city->setState($this);
}
return $this;
}
public function removeCity(City $city): self
{
if ($this->cities->removeElement($city)) {
// set the owning side to null (unless already changed)
if ($city->getState() === $this) {
$city->setState(null);
}
}
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->setState($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->getState() === $this) {
$customerBilling->setState(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
}