src/Flexy/ShopBundle/Entity/Shipping/CityRegion.php line 16

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Shipping;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Order\Order;
  5. use App\Flexy\ShopBundle\Entity\Store\Store;
  6. use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
  7. use App\Flexy\ShopBundle\Repository\Shipping\CityRegionRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ApiResource]
  12. #[ORM\Entity(repositoryClassCityRegionRepository::class)]
  13. class CityRegion implements \Stringable
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private $id;
  19.     #[ORM\Column(type'string'length255)]
  20.     private ?string $name null;
  21.     #[ORM\Column(type'text'nullabletrue)]
  22.     private ?string $description null;
  23.     #[ORM\Column(type'boolean'nullabletrue)]
  24.     private $isDefault;
  25.     
  26.     #[ORM\Column(type'boolean'nullabletrue)]
  27.     private $isActive;
  28.     #[ORM\ManyToOne(targetEntityCity::class, inversedBy'regions')]
  29.     private ?\App\Flexy\ShopBundle\Entity\Shipping\City $city null;
  30.     #[ORM\Column(type'string'length255nullabletrue)]
  31.     private ?string $color null;
  32.     #[ORM\Column(type'string'length255nullabletrue)]
  33.     private $type;
  34.         #[ORM\Column(type'string'length255nullabletrue)]
  35.     private $zipCode;
  36.     #[ORM\Column(type'string'length255nullabletrue)]
  37.     private $regionCode;
  38.     #[ORM\Column(type'string'length255nullabletrue)]
  39.     private $lng;
  40.         #[ORM\Column(type'string'length255nullabletrue)]
  41.     private $lat;
  42.     #[ORM\ManyToMany(targetEntityShippingMethod::class, mappedBy'cityRegions')]
  43.     private \Doctrine\Common\Collections\Collection|array $shippingMethods;
  44.     #[ORM\ManyToOne(targetEntityVendor::class)]
  45.     private $vendor;
  46.     #[ORM\OneToMany(targetEntityOrder::class, mappedBy'cityRegion')]
  47.     private \Doctrine\Common\Collections\Collection|array $orders;
  48.         #[ORM\OneToMany(targetEntityOrder::class, mappedBy'cityRegionCollect')]
  49.     private \Doctrine\Common\Collections\Collection|array $collectedOrders ;
  50.     #[ORM\OneToMany(targetEntityShipmentItem::class, mappedBy'shippingCityRegion')]
  51.     private \Doctrine\Common\Collections\Collection|array $shipmentItemsShipped;
  52.      #[ORM\OneToMany(targetEntityShipmentItem::class, mappedBy'collectCityRegion')]
  53.     private \Doctrine\Common\Collections\Collection|array $shipmentItemsCollected ;
  54.      #[ORM\OneToMany(mappedBy'ÂcityRegion'targetEntityStore::class)]
  55.      private Collection $stores;
  56.      #[ORM\OneToMany(mappedBy'collectCityRegion'targetEntityShipment::class)]
  57.      private Collection $collectedShipments;
  58.      #[ORM\OneToMany(mappedBy'shippingCityRegion'targetEntityShipment::class)]
  59.      private Collection $shippedShipments;
  60.     
  61.     
  62.     public function __construct()
  63.     {
  64.         $this->shippingMethods = new ArrayCollection();
  65.         $this->orders = new ArrayCollection();
  66.         $this->stores = new ArrayCollection();
  67.         $this->collectedShipments = new ArrayCollection();
  68.         $this->shippedShipments = new ArrayCollection();
  69.     }
  70.     public function __toString(): string
  71.     {
  72.         return (string)$this->name;
  73.     }
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(string $name): self
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getDescription(): ?string
  88.     {
  89.         return $this->description;
  90.     }
  91.     public function setDescription(?string $description): self
  92.     {
  93.         $this->description $description;
  94.         return $this;
  95.     }
  96.     public function getCity(): ?City
  97.     {
  98.         return $this->city;
  99.     }
  100.     public function setCity(?City $city): self
  101.     {
  102.         $this->city $city;
  103.         return $this;
  104.     }
  105.     public function getColor(): ?string
  106.     {
  107.         return $this->color;
  108.     }
  109.     public function setColor(?string $color): self
  110.     {
  111.         $this->color $color;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, ShippingMethod>
  116.      */
  117.     public function getShippingMethods(): Collection
  118.     {
  119.         return $this->shippingMethods;
  120.     }
  121.     public function addShippingMethod(ShippingMethod $shippingMethod): self
  122.     {
  123.         if (!$this->shippingMethods->contains($shippingMethod)) {
  124.             $this->shippingMethods[] = $shippingMethod;
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeShippingMethod(ShippingMethod $shippingMethod): self
  129.     {
  130.         $this->shippingMethods->removeElement($shippingMethod);
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return Collection<int, Order>
  135.      */
  136.     public function getOrders(): Collection
  137.     {
  138.         return $this->orders;
  139.     }
  140.     public function addOrder(Order $order): self
  141.     {
  142.         if (!$this->orders->contains($order)) {
  143.             $this->orders[] = $order;
  144.             $order->setCityRegion($this);
  145.         }
  146.         return $this;
  147.     }
  148.     public function removeOrder(Order $order): self
  149.     {
  150.         if ($this->orders->removeElement($order)) {
  151.             // set the owning side to null (unless already changed)
  152.             if ($order->getCityRegion() === $this) {
  153.                 $order->setCityRegion(null);
  154.             }
  155.         }
  156.         return $this;
  157.     }
  158.         /**
  159.      * @return Collection<int, Order>
  160.      */
  161.     public function getCollectedOrders(): Collection
  162.     {
  163.         return $this->collectedOrders;
  164.     }
  165.     public function addCollectedOrder(Order $collectedOrder): self
  166.     {
  167.         if (!$this->collectedOrders->contains($collectedOrder)) {
  168.             $this->collectedOrders[] = $collectedOrder;
  169.             $collectedOrder->setCityRegionCollect($this);
  170.         }
  171.         return $this;
  172.     }
  173.     public function removeCollectedOrder(Order $collectedOrder): self
  174.     {
  175.         if ($this->collectedOrders->removeElement($collectedOrder)) {
  176.             // set the owning side to null (unless already changed)
  177.             if ($collectedOrder->getCityRegionCollect() === $this) {
  178.                 $collectedOrder->setCityRegionCollect(null);
  179.             }
  180.         }
  181.         return $this;
  182.     }
  183.                 /**
  184.      * @return Collection<int, ShipmentItem>
  185.      */
  186.     public function getShipmentItemsCollected(): Collection
  187.     {
  188.         return $this->shipmentItemsCollected;
  189.     }
  190.     public function addShipmentItemCollected(ShipmentItem $shipmentItemCollected): self
  191.     {
  192.         if (!$this->shipmentItemsCollected->contains($shipmentItemCollected)) {
  193.             $this->shipmentItemsCollected[] = $shipmentItemCollected;
  194.             $shipmentItemCollected->setCollectCityRegion($this);
  195.         }
  196.         return $this;
  197.     }
  198.     public function removeShipmentItemCollected(ShipmentItem $shipmentItemCollected): self
  199.     {
  200.         if ($this->shipmentItemsCollected->removeElement($shipmentItemCollected)) {
  201.             // set the owning side to null (unless already changed)
  202.             if ($shipmentItemCollected->getCollectCityRegion() === $this) {
  203.                 $shipmentItemCollected->setCollectCityRegion(null);
  204.             }
  205.         }
  206.         return $this;
  207.     }
  208.             /**
  209.      * @return Collection<int, ShipmentItem>
  210.      */
  211.     public function getShipmentItemsShipped(): Collection
  212.     {
  213.         return $this->shipmentItemsShipped;
  214.     }
  215.     public function addShipmentItemShipped(ShipmentItem $shipmentItemShipped): self
  216.     {
  217.         if (!$this->shipmentItemsShipped->contains($shipmentItemShipped)) {
  218.             $this->shipmentItemsShipped[] = $shipmentItemShipped;
  219.             $shipmentItemShipped->setShippingCityRegion($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeShipmentItemShipped(ShipmentItem $shipmentItemShipped): self
  224.     {
  225.         if ($this->shipmentItemsShipped->removeElement($shipmentItemShipped)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($shipmentItemShipped->getShippingCityRegion() === $this) {
  228.                 $shipmentItemShipped->setShippingCityRegion(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233.     /**
  234.      * Get the value of lng
  235.      */ 
  236.     public function getLng()
  237.     {
  238.         return $this->lng;
  239.     }
  240.     /**
  241.      * Set the value of lng
  242.      *
  243.      * @return  self
  244.      */ 
  245.     public function setLng($lng)
  246.     {
  247.         $this->lng $lng;
  248.         return $this;
  249.     }
  250.     /**
  251.      * Get the value of lat
  252.      */ 
  253.     public function getLat()
  254.     {
  255.         return $this->lat;
  256.     }
  257.     /**
  258.      * Set the value of lat
  259.      *
  260.      * @return  self
  261.      */ 
  262.     public function setLat($lat)
  263.     {
  264.         $this->lat $lat;
  265.         return $this;
  266.     }
  267.     /**
  268.      * Get the value of type
  269.      */ 
  270.     public function getType()
  271.     {
  272.         return $this->type;
  273.     }
  274.     /**
  275.      * Set the value of type
  276.      *
  277.      * @return  self
  278.      */ 
  279.     public function setType($type)
  280.     {
  281.         $this->type $type;
  282.         return $this;
  283.     }
  284.     /**
  285.      * Get the value of zipCode
  286.      */ 
  287.     public function getZipCode()
  288.     {
  289.         return $this->zipCode;
  290.     }
  291.     /**
  292.      * Set the value of zipCode
  293.      *
  294.      * @return  self
  295.      */ 
  296.     public function setZipCode($zipCode)
  297.     {
  298.         $this->zipCode $zipCode;
  299.         return $this;
  300.     }
  301.     /**
  302.      * Get the value of regionCode
  303.      */ 
  304.     public function getRegionCode()
  305.     {
  306.         return $this->regionCode;
  307.     }
  308.     /**
  309.      * Set the value of regionCode
  310.      *
  311.      * @return  self
  312.      */ 
  313.     public function setRegionCode($regionCode)
  314.     {
  315.         $this->regionCode $regionCode;
  316.         return $this;
  317.     }
  318.     /**
  319.      * Get the value of vendor
  320.      */ 
  321.     public function getVendor()
  322.     {
  323.         return $this->vendor;
  324.     }
  325.     /**
  326.      * Set the value of vendor
  327.      *
  328.      * @return  self
  329.      */ 
  330.     public function setVendor($vendor)
  331.     {
  332.         $this->vendor $vendor;
  333.         return $this;
  334.     }
  335.     /**
  336.      * Get the value of isDefault
  337.      */ 
  338.     public function getIsDefault()
  339.     {
  340.         return $this->isDefault;
  341.     }
  342.     /**
  343.      * Set the value of isDefault
  344.      *
  345.      * @return  self
  346.      */ 
  347.     public function setIsDefault($isDefault)
  348.     {
  349.         $this->isDefault $isDefault;
  350.         return $this;
  351.     }
  352.     /**
  353.      * Get the value of isActive
  354.      */ 
  355.     public function getIsActive()
  356.     {
  357.         return $this->isActive;
  358.     }
  359.     /**
  360.      * Set the value of isActive
  361.      *
  362.      * @return  self
  363.      */ 
  364.     public function setIsActive($isActive)
  365.     {
  366.         $this->isActive $isActive;
  367.         return $this;
  368.     }
  369.     /**
  370.      * @return Collection<int, Store>
  371.      */
  372.     public function getStores(): Collection
  373.     {
  374.         return $this->stores;
  375.     }
  376.     public function addStore(Store $store): self
  377.     {
  378.         if (!$this->stores->contains($store)) {
  379.             $this->stores->add($store);
  380.             $store->setÂcityRegion($this);
  381.         }
  382.         return $this;
  383.     }
  384.     public function removeStore(Store $store): self
  385.     {
  386.         if ($this->stores->removeElement($store)) {
  387.             // set the owning side to null (unless already changed)
  388.             if ($store->getÂcityRegion() === $this) {
  389.                 $store->setÂcityRegion(null);
  390.             }
  391.         }
  392.         return $this;
  393.     }
  394.     /**
  395.      * @return Collection<int, Shipment>
  396.      */
  397.     public function getCollectedShipments(): Collection
  398.     {
  399.         return $this->collectedShipments;
  400.     }
  401.     public function addCollectedShipment(Shipment $collectedShipment): self
  402.     {
  403.         if (!$this->collectedShipments->contains($collectedShipment)) {
  404.             $this->collectedShipments->add($collectedShipment);
  405.             $collectedShipment->setCollectCityRegion($this);
  406.         }
  407.         return $this;
  408.     }
  409.     public function removeCollectedShipment(Shipment $collectedShipment): self
  410.     {
  411.         if ($this->collectedShipments->removeElement($collectedShipment)) {
  412.             // set the owning side to null (unless already changed)
  413.             if ($collectedShipment->getCollectCityRegion() === $this) {
  414.                 $collectedShipment->setCollectCityRegion(null);
  415.             }
  416.         }
  417.         return $this;
  418.     }
  419.     /**
  420.      * @return Collection<int, Shipment>
  421.      */
  422.     public function getShippedShipments(): Collection
  423.     {
  424.         return $this->shippedShipments;
  425.     }
  426.     public function addShippedShipment(Shipment $shippedShipment): self
  427.     {
  428.         if (!$this->shippedShipments->contains($shippedShipment)) {
  429.             $this->shippedShipments->add($shippedShipment);
  430.             $shippedShipment->setShippingCityRegion($this);
  431.         }
  432.         return $this;
  433.     }
  434.     public function removeShippedShipment(Shipment $shippedShipment): self
  435.     {
  436.         if ($this->shippedShipments->removeElement($shippedShipment)) {
  437.             // set the owning side to null (unless already changed)
  438.             if ($shippedShipment->getShippingCityRegion() === $this) {
  439.                 $shippedShipment->setShippingCityRegion(null);
  440.             }
  441.         }
  442.         return $this;
  443.     }
  444. }