src/Flexy/ShopBundle/Entity/Shipping/CityRegion.php line 16
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Entity\Order\Order;
use App\Flexy\ShopBundle\Entity\Store\Store;
use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
use App\Flexy\ShopBundle\Repository\Shipping\CityRegionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: CityRegionRepository::class)]
class CityRegion implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isDefault;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isActive;
#[ORM\ManyToOne(targetEntity: City::class, inversedBy: 'regions')]
private ?\App\Flexy\ShopBundle\Entity\Shipping\City $city = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $color = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $type;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $zipCode;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $regionCode;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $lng;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $lat;
#[ORM\ManyToMany(targetEntity: ShippingMethod::class, mappedBy: 'cityRegions')]
private \Doctrine\Common\Collections\Collection|array $shippingMethods;
#[ORM\ManyToOne(targetEntity: Vendor::class)]
private $vendor;
#[ORM\OneToMany(targetEntity: Order::class, mappedBy: 'cityRegion')]
private \Doctrine\Common\Collections\Collection|array $orders;
#[ORM\OneToMany(targetEntity: Order::class, mappedBy: 'cityRegionCollect')]
private \Doctrine\Common\Collections\Collection|array $collectedOrders ;
#[ORM\OneToMany(targetEntity: ShipmentItem::class, mappedBy: 'shippingCityRegion')]
private \Doctrine\Common\Collections\Collection|array $shipmentItemsShipped;
#[ORM\OneToMany(targetEntity: ShipmentItem::class, mappedBy: 'collectCityRegion')]
private \Doctrine\Common\Collections\Collection|array $shipmentItemsCollected ;
#[ORM\OneToMany(mappedBy: 'ÂcityRegion', targetEntity: Store::class)]
private Collection $stores;
#[ORM\OneToMany(mappedBy: 'collectCityRegion', targetEntity: Shipment::class)]
private Collection $collectedShipments;
#[ORM\OneToMany(mappedBy: 'shippingCityRegion', targetEntity: Shipment::class)]
private Collection $shippedShipments;
public function __construct()
{
$this->shippingMethods = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->stores = new ArrayCollection();
$this->collectedShipments = new ArrayCollection();
$this->shippedShipments = new ArrayCollection();
}
public function __toString(): string
{
return (string)$this->name;
}
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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCity(): ?City
{
return $this->city;
}
public function setCity(?City $city): self
{
$this->city = $city;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
/**
* @return Collection<int, ShippingMethod>
*/
public function getShippingMethods(): Collection
{
return $this->shippingMethods;
}
public function addShippingMethod(ShippingMethod $shippingMethod): self
{
if (!$this->shippingMethods->contains($shippingMethod)) {
$this->shippingMethods[] = $shippingMethod;
}
return $this;
}
public function removeShippingMethod(ShippingMethod $shippingMethod): self
{
$this->shippingMethods->removeElement($shippingMethod);
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setCityRegion($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getCityRegion() === $this) {
$order->setCityRegion(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getCollectedOrders(): Collection
{
return $this->collectedOrders;
}
public function addCollectedOrder(Order $collectedOrder): self
{
if (!$this->collectedOrders->contains($collectedOrder)) {
$this->collectedOrders[] = $collectedOrder;
$collectedOrder->setCityRegionCollect($this);
}
return $this;
}
public function removeCollectedOrder(Order $collectedOrder): self
{
if ($this->collectedOrders->removeElement($collectedOrder)) {
// set the owning side to null (unless already changed)
if ($collectedOrder->getCityRegionCollect() === $this) {
$collectedOrder->setCityRegionCollect(null);
}
}
return $this;
}
/**
* @return Collection<int, ShipmentItem>
*/
public function getShipmentItemsCollected(): Collection
{
return $this->shipmentItemsCollected;
}
public function addShipmentItemCollected(ShipmentItem $shipmentItemCollected): self
{
if (!$this->shipmentItemsCollected->contains($shipmentItemCollected)) {
$this->shipmentItemsCollected[] = $shipmentItemCollected;
$shipmentItemCollected->setCollectCityRegion($this);
}
return $this;
}
public function removeShipmentItemCollected(ShipmentItem $shipmentItemCollected): self
{
if ($this->shipmentItemsCollected->removeElement($shipmentItemCollected)) {
// set the owning side to null (unless already changed)
if ($shipmentItemCollected->getCollectCityRegion() === $this) {
$shipmentItemCollected->setCollectCityRegion(null);
}
}
return $this;
}
/**
* @return Collection<int, ShipmentItem>
*/
public function getShipmentItemsShipped(): Collection
{
return $this->shipmentItemsShipped;
}
public function addShipmentItemShipped(ShipmentItem $shipmentItemShipped): self
{
if (!$this->shipmentItemsShipped->contains($shipmentItemShipped)) {
$this->shipmentItemsShipped[] = $shipmentItemShipped;
$shipmentItemShipped->setShippingCityRegion($this);
}
return $this;
}
public function removeShipmentItemShipped(ShipmentItem $shipmentItemShipped): self
{
if ($this->shipmentItemsShipped->removeElement($shipmentItemShipped)) {
// set the owning side to null (unless already changed)
if ($shipmentItemShipped->getShippingCityRegion() === $this) {
$shipmentItemShipped->setShippingCityRegion(null);
}
}
return $this;
}
/**
* Get the value of lng
*/
public function getLng()
{
return $this->lng;
}
/**
* Set the value of lng
*
* @return self
*/
public function setLng($lng)
{
$this->lng = $lng;
return $this;
}
/**
* Get the value of lat
*/
public function getLat()
{
return $this->lat;
}
/**
* Set the value of lat
*
* @return self
*/
public function setLat($lat)
{
$this->lat = $lat;
return $this;
}
/**
* Get the value of type
*/
public function getType()
{
return $this->type;
}
/**
* Set the value of type
*
* @return self
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get the value of zipCode
*/
public function getZipCode()
{
return $this->zipCode;
}
/**
* Set the value of zipCode
*
* @return self
*/
public function setZipCode($zipCode)
{
$this->zipCode = $zipCode;
return $this;
}
/**
* Get the value of regionCode
*/
public function getRegionCode()
{
return $this->regionCode;
}
/**
* Set the value of regionCode
*
* @return self
*/
public function setRegionCode($regionCode)
{
$this->regionCode = $regionCode;
return $this;
}
/**
* Get the value of vendor
*/
public function getVendor()
{
return $this->vendor;
}
/**
* Set the value of vendor
*
* @return self
*/
public function setVendor($vendor)
{
$this->vendor = $vendor;
return $this;
}
/**
* Get the value of isDefault
*/
public function getIsDefault()
{
return $this->isDefault;
}
/**
* Set the value of isDefault
*
* @return self
*/
public function setIsDefault($isDefault)
{
$this->isDefault = $isDefault;
return $this;
}
/**
* Get the value of isActive
*/
public function getIsActive()
{
return $this->isActive;
}
/**
* Set the value of isActive
*
* @return self
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* @return Collection<int, Store>
*/
public function getStores(): Collection
{
return $this->stores;
}
public function addStore(Store $store): self
{
if (!$this->stores->contains($store)) {
$this->stores->add($store);
$store->setÂcityRegion($this);
}
return $this;
}
public function removeStore(Store $store): self
{
if ($this->stores->removeElement($store)) {
// set the owning side to null (unless already changed)
if ($store->getÂcityRegion() === $this) {
$store->setÂcityRegion(null);
}
}
return $this;
}
/**
* @return Collection<int, Shipment>
*/
public function getCollectedShipments(): Collection
{
return $this->collectedShipments;
}
public function addCollectedShipment(Shipment $collectedShipment): self
{
if (!$this->collectedShipments->contains($collectedShipment)) {
$this->collectedShipments->add($collectedShipment);
$collectedShipment->setCollectCityRegion($this);
}
return $this;
}
public function removeCollectedShipment(Shipment $collectedShipment): self
{
if ($this->collectedShipments->removeElement($collectedShipment)) {
// set the owning side to null (unless already changed)
if ($collectedShipment->getCollectCityRegion() === $this) {
$collectedShipment->setCollectCityRegion(null);
}
}
return $this;
}
/**
* @return Collection<int, Shipment>
*/
public function getShippedShipments(): Collection
{
return $this->shippedShipments;
}
public function addShippedShipment(Shipment $shippedShipment): self
{
if (!$this->shippedShipments->contains($shippedShipment)) {
$this->shippedShipments->add($shippedShipment);
$shippedShipment->setShippingCityRegion($this);
}
return $this;
}
public function removeShippedShipment(Shipment $shippedShipment): self
{
if ($this->shippedShipments->removeElement($shippedShipment)) {
// set the owning side to null (unless already changed)
if ($shippedShipment->getShippingCityRegion() === $this) {
$shippedShipment->setShippingCityRegion(null);
}
}
return $this;
}
}