src/Entity/State.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StateRepository;
  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=StateRepository::class)
  11.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12.  */
  13. class State 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=country::class, inversedBy="countryCode")
  28.      */
  29.     private $country;
  30.     /**
  31.      * @ORM\Column(type="string", length=2)
  32.      */
  33.     private $countryCode;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $fipsCode;
  38.     /**
  39.      * @ORM\Column(type="string", length=2, nullable=true)
  40.      */
  41.     private $iso2;
  42.     /**
  43.      * @ORM\Column(type="string", length=191, nullable=true)
  44.      */
  45.     private $type;
  46.     /**
  47.      * @ORM\Column(type="decimal", precision=10, scale=8, nullable=true)
  48.      */
  49.     private $latitude;
  50.     /**
  51.      * @ORM\Column(type="decimal", precision=11, scale=8, nullable=true)
  52.      */
  53.     private $longitude;
  54.     /**
  55.      * @ORM\Column(type="binary", options={"default": 1})
  56.      */
  57.     private $flag;
  58.     /**
  59.      * @ORM\Column(name="wikiDataId", type="string", length=255, nullable=true)
  60.      */
  61.     private $wikiDataId;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=City::class, mappedBy="State")
  64.      */
  65.     private $cities;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity=CustomerBilling::class, mappedBy="State")
  68.      */
  69.     private $customerBillings;
  70.     public function __construct()
  71.     {
  72.         $this->cities = new ArrayCollection();
  73.         $this->customerBillings = new ArrayCollection();
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getName(): ?string
  80.     {
  81.         return $this->name;
  82.     }
  83.     public function setName(string $name): self
  84.     {
  85.         $this->name $name;
  86.         return $this;
  87.     }
  88.     public function getCountry(): ?country
  89.     {
  90.         return $this->country;
  91.     }
  92.     public function setCountry(?country $country): self
  93.     {
  94.         $this->country $country;
  95.         return $this;
  96.     }
  97.     public function getCountryCode(): ?string
  98.     {
  99.         return $this->countryCode;
  100.     }
  101.     public function setCountryCode(string $countryCode): self
  102.     {
  103.         $this->countryCode $countryCode;
  104.         return $this;
  105.     }
  106.     public function getFipsCode(): ?string
  107.     {
  108.         return $this->fipsCode;
  109.     }
  110.     public function setFipsCode(?string $fipsCode): self
  111.     {
  112.         $this->fipsCode $fipsCode;
  113.         return $this;
  114.     }
  115.     public function getIso2(): ?string
  116.     {
  117.         return $this->iso2;
  118.     }
  119.     public function setIso2(?string $iso2): self
  120.     {
  121.         $this->iso2 $iso2;
  122.         return $this;
  123.     }
  124.     public function getType(): ?string
  125.     {
  126.         return $this->type;
  127.     }
  128.     public function setType(?string $type): self
  129.     {
  130.         $this->type $type;
  131.         return $this;
  132.     }
  133.     public function getLatitude(): ?string
  134.     {
  135.         return $this->latitude;
  136.     }
  137.     public function setLatitude(?string $latitude): self
  138.     {
  139.         $this->latitude $latitude;
  140.         return $this;
  141.     }
  142.     public function getLongitude(): ?string
  143.     {
  144.         return $this->longitude;
  145.     }
  146.     public function setLongitude(string $longitude): self
  147.     {
  148.         $this->longitude $longitude;
  149.         return $this;
  150.     }
  151.     public function getFlag()
  152.     {
  153.         return $this->flag;
  154.     }
  155.     public function setFlag($flag): self
  156.     {
  157.         $this->flag $flag;
  158.         return $this;
  159.     }
  160.     public function getWikiDataId(): ?string
  161.     {
  162.         return $this->wikiDataId;
  163.     }
  164.     public function setWikiDataId(?string $wikiDataId): self
  165.     {
  166.         $this->wikiDataId $wikiDataId;
  167.         return $this;
  168.     }
  169.     /**
  170.      * @return Collection<int, City>
  171.      */
  172.     public function getCities(): Collection
  173.     {
  174.         return $this->cities;
  175.     }
  176.     public function addCity(City $city): self
  177.     {
  178.         if (!$this->cities->contains($city)) {
  179.             $this->cities[] = $city;
  180.             $city->setState($this);
  181.         }
  182.         return $this;
  183.     }
  184.     public function removeCity(City $city): self
  185.     {
  186.         if ($this->cities->removeElement($city)) {
  187.             // set the owning side to null (unless already changed)
  188.             if ($city->getState() === $this) {
  189.                 $city->setState(null);
  190.             }
  191.         }
  192.         return $this;
  193.     }
  194.     /**
  195.      * @return Collection<int, CustomerBilling>
  196.      */
  197.     public function getCustomerBillings(): Collection
  198.     {
  199.         return $this->customerBillings;
  200.     }
  201.     public function addCustomerBilling(CustomerBilling $customerBilling): self
  202.     {
  203.         if (!$this->customerBillings->contains($customerBilling)) {
  204.             $this->customerBillings[] = $customerBilling;
  205.             $customerBilling->setState($this);
  206.         }
  207.         return $this;
  208.     }
  209.     public function removeCustomerBilling(CustomerBilling $customerBilling): self
  210.     {
  211.         if ($this->customerBillings->removeElement($customerBilling)) {
  212.             // set the owning side to null (unless already changed)
  213.             if ($customerBilling->getState() === $this) {
  214.                 $customerBilling->setState(null);
  215.             }
  216.         }
  217.         return $this;
  218.     }
  219.     public function __toString()
  220.     {
  221.         return $this->name;
  222.     }
  223. }