src/Entity/City.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CityRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass=CityRepository::class)
  11.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12.  */
  13. class City extends BaseEntity
  14. {
  15.     use SoftDeleteableEntity;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=State::class, inversedBy="cities")
  28.      */
  29.     private $state;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $stateCode;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="cities")
  36.      */
  37.     private $country;
  38.     /**
  39.      * @ORM\Column(type="string", length=2)
  40.      */
  41.     private $countryCode;
  42.     /**
  43.      * @ORM\Column(type="decimal", precision=10, scale=8, nullable=true)
  44.      */
  45.     private $latitude;
  46.     /**
  47.      * @ORM\Column(type="decimal", precision=11, scale=8, nullable=true)
  48.      */
  49.     private $longitude;
  50.     /**
  51.      * @ORM\Column(type="binary", options={"default": 1})
  52.      */
  53.     private $flag;
  54.     /**
  55.      * @ORM\Column(name="wikiDataId", type="string", length=255, nullable=true)
  56.      */
  57.     private $wikiDataId;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=CustomerBilling::class, mappedBy="city")
  60.      */
  61.     private $customerBillings;
  62.     public function __construct()
  63.     {
  64.         $this->customerBillings = new ArrayCollection();
  65.     }
  66.     public function getId(): ?int
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getName(): ?string
  71.     {
  72.         return $this->name;
  73.     }
  74.     public function setName(string $name): self
  75.     {
  76.         $this->name $name;
  77.         return $this;
  78.     }
  79.     public function getState(): ?State
  80.     {
  81.         return $this->state;
  82.     }
  83.     public function setState(?State $state): self
  84.     {
  85.         $this->state $state;
  86.         return $this;
  87.     }
  88.     public function getStateCode(): ?string
  89.     {
  90.         return $this->stateCode;
  91.     }
  92.     public function setStateCode(string $stateCode): self
  93.     {
  94.         $this->stateCode $stateCode;
  95.         return $this;
  96.     }
  97.     public function getCountry(): ?Country
  98.     {
  99.         return $this->country;
  100.     }
  101.     public function setCountry(?Country $country): self
  102.     {
  103.         $this->country $country;
  104.         return $this;
  105.     }
  106.     public function getCountryCode(): ?string
  107.     {
  108.         return $this->countryCode;
  109.     }
  110.     public function setCountryCode(string $countryCode): self
  111.     {
  112.         $this->countryCode $countryCode;
  113.         return $this;
  114.     }
  115.     public function getLatitude(): ?string
  116.     {
  117.         return $this->latitude;
  118.     }
  119.     public function setLatitude(?string $latitude): self
  120.     {
  121.         $this->latitude $latitude;
  122.         return $this;
  123.     }
  124.     public function getLongitude(): ?string
  125.     {
  126.         return $this->longitude;
  127.     }
  128.     public function setLongitude(?string $longitude): self
  129.     {
  130.         $this->longitude $longitude;
  131.         return $this;
  132.     }
  133.     public function getFlag()
  134.     {
  135.         return $this->flag;
  136.     }
  137.     public function setFlag($flag): self
  138.     {
  139.         $this->flag $flag;
  140.         return $this;
  141.     }
  142.     public function getWikiDataId(): ?string
  143.     {
  144.         return $this->wikiDataId;
  145.     }
  146.     public function setWikiDataId(?string $wikiDataId): self
  147.     {
  148.         $this->wikiDataId $wikiDataId;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return Collection<int, CustomerBilling>
  153.      */
  154.     public function getCustomerBillings(): Collection
  155.     {
  156.         return $this->customerBillings;
  157.     }
  158.     public function addCustomerBilling(CustomerBilling $customerBilling): self
  159.     {
  160.         if (!$this->customerBillings->contains($customerBilling)) {
  161.             $this->customerBillings[] = $customerBilling;
  162.             $customerBilling->setCity($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeCustomerBilling(CustomerBilling $customerBilling): self
  167.     {
  168.         if ($this->customerBillings->removeElement($customerBilling)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($customerBilling->getCity() === $this) {
  171.                 $customerBilling->setCity(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176.     public function __toString()
  177.     {
  178.         return $this->name;
  179.     }
  180. }