src/Flexy/ShopBundle/Entity/Shipping/ShippingMethod.php line 22
<?phpnamespace App\Flexy\ShopBundle\Entity\Shipping;use ApiPlatform\Core\Annotation\ApiResource;use App\Flexy\ShopBundle\Entity\Order\Order;use App\Flexy\ShopBundle\Entity\Customer\CustomerGroup;use App\Flexy\ShopBundle\Entity\Taxes\ShippingTax;use App\Flexy\ShopBundle\Entity\Taxes\ValueAddedTax;use App\Repository\Flexy\ShopBundle\Entity\Shipping\ShippingRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use App\Flexy\ShopBundle\Entity\Shipping\ShippingVehicleType;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use Gedmo\Mapping\Annotation as Gedmo;use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;#[ApiResource]#[ORM\Entity(repositoryClass: ShippingRepository::class)]#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]class ShippingMethod implements \Stringable{use SoftDeleteableEntity;#[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: 'string', length: 255)]private string $code = "SHIP001";#[ORM\Column(type: 'boolean', nullable: true)]private ?bool $isEnabled = null;#[ORM\Column(type: 'datetime_immutable', nullable: true)]private ?\DateTimeImmutable $createdAt = null;#[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'method')]private \Doctrine\Common\Collections\Collection|array $shippments;#[ORM\Column(type: 'integer', nullable: true)]private ?int $processingDuration = null;#[ORM\Column(type: 'float', nullable: true)]private ?float $preparationDuration = null;#[ORM\Column(type: 'float', nullable: true)]private ?float $shippingDuration = null;#[ORM\Column(type: 'float', nullable: true)]private ?float $price = null;#[ORM\OneToMany(targetEntity: ShippingRule::class, mappedBy: 'shippingMethod', cascade: ['persist', 'remove'])]#[Assert\Valid()]private \Doctrine\Common\Collections\Collection|array $shippingRules;#[ORM\OneToMany(targetEntity: Order::class, mappedBy: 'shippingMethod')]private \Doctrine\Common\Collections\Collection|array $orders;#[ORM\ManyToMany(targetEntity: CityRegion::class, inversedBy: 'shippingMethods')]private \Doctrine\Common\Collections\Collection|array $cityRegions;#[ORM\ManyToOne(targetEntity: ShippingVehicleType::class, inversedBy: 'shippingMethods')]#[ORM\JoinColumn(nullable: true)]private $shippingVehicleType;#[ORM\ManyToOne(targetEntity: CustomerGroup::class, inversedBy: 'shippingMethods')]#[ORM\JoinColumn(nullable: true)]private $customerGroup;#[ORM\Column(nullable: true)]private ?bool $isSeparatelyCalculated = null;#[ORM\Column(nullable: true)]private array $calculationMethod = [];#[ORM\ManyToOne]private ?ValueAddedTax $taxVAT = null;#[ORM\ManyToOne]private ?ShippingTax $shippingTax = null;#[ORM\Column(nullable: true)]private ?float $declaredValueTax = null;#[ORM\Column(nullable: true)]private ?float $papersFees = null;#[ORM\Column(nullable: true)]private ?float $codCashFees = null;#[ORM\Column(nullable: true)]private ?float $codCheckOrBillFees = null;#[ORM\OneToMany(mappedBy: 'shippingMethod', targetEntity: ShippingCalculationMethod::class,cascade:["persist","remove"])]private Collection $calculationMethods;#[ORM\Column(nullable: true)]private ?bool $isTaxesIncludedInPrice = null;public function __toString(): string{return (string) $this->name;}public function __construct(){$this->shippments = new ArrayCollection();$this->shippingRules = new ArrayCollection();$this->orders = new ArrayCollection();$this->cityRegions = new ArrayCollection();$this->calculationMethods = 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 getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getCode(): ?string{return $this->code;}public function setCode(string $code): self{$this->code = $code;return $this;}public function getIsEnabled(): ?bool{return $this->isEnabled;}public function setIsEnabled(?bool $isEnabled): self{$this->isEnabled = $isEnabled;return $this;}public function getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(?\DateTimeImmutable $createdAt): self{$this->createdAt = $createdAt;return $this;}/*** @return Collection|Shipment[]*/public function getShipments(): Collection{return $this->shippments;}public function addShipment(Shipment $shippment): self{if (!$this->shippments->contains($shippment)) {$this->shippments[] = $shippment;$shippment->setMethod($this);}return $this;}public function removeShipment(Shipment $shippment): self{if ($this->shippments->removeElement($shippment)) {// set the owning side to null (unless already changed)if ($shippment->getMethod() === $this) {$shippment->setMethod(null);}}return $this;}public function getProcessingDuration(): ?int{return $this->processingDuration;}public function setProcessingDuration(?int $processingDuration): self{$this->processingDuration = $processingDuration;return $this;}public function getPreparationDuration(): ?float{return $this->preparationDuration;}public function setPreparationDuration(?float $preparationDuration): self{$this->preparationDuration = $preparationDuration;return $this;}public function getShippingDuration(): ?float{return $this->shippingDuration;}public function setShippingDuration(?float $shippingDuration): self{$this->shippingDuration = $shippingDuration;return $this;}public function getPrice(): ?float{return $this->price;}public function setPrice(?float $price): self{$this->price = $price;return $this;}/*** @return Collection<int, ShippingRule>*/public function getShippingRules(): Collection{return $this->shippingRules;}public function addShippingRule(ShippingRule $shippingRule): self{if (!$this->shippingRules->contains($shippingRule)) {$this->shippingRules[] = $shippingRule;$shippingRule->setShippingMethod($this);}return $this;}public function removeShippingRule(ShippingRule $shippingRule): self{if ($this->shippingRules->removeElement($shippingRule)) {// set the owning side to null (unless already changed)if ($shippingRule->getShippingMethod() === $this) {$shippingRule->setShippingMethod(null);}}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->setShippingMethod($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->getShippingMethod() === $this) {$order->setShippingMethod(null);}}return $this;}/*** @return Collection<int, CityRegion>*/public function getCityRegions(): Collection{return $this->cityRegions;}public function addCityRegion(CityRegion $cityRegion): self{if (!$this->cityRegions->contains($cityRegion)) {$this->cityRegions[] = $cityRegion;$cityRegion->addShippingMethod($this);}return $this;}public function removeCityRegion(CityRegion $cityRegion): self{if ($this->cityRegions->removeElement($cityRegion)) {$cityRegion->removeShippingMethod($this);}return $this;}/*** Get the value of shippingVehicleType*/public function getShippingVehicleType(){return $this->shippingVehicleType;}/*** Set the value of shippingVehicleType** @return self*/public function setShippingVehicleType($shippingVehicleType){$this->shippingVehicleType = $shippingVehicleType;return $this;}/*** Get the value of customerGroup*/public function getCustomerGroup(){return $this->customerGroup;}/*** Set the value of customerGroup** @return self*/public function setCustomerGroup($customerGroup){$this->customerGroup = $customerGroup;return $this;}public function isIsSeparatelyCalculated(): ?bool{return $this->isSeparatelyCalculated;}public function setIsSeparatelyCalculated(?bool $isSeparatelyCalculated): self{$this->isSeparatelyCalculated = $isSeparatelyCalculated;return $this;}public function getCalculationMethod(): array{return $this->calculationMethod;}public function setCalculationMethod(?array $calculationMethod): self{$this->calculationMethod = $calculationMethod;return $this;}public function getTaxVAT(): ?ValueAddedTax{return $this->taxVAT;}public function setTaxVAT(?ValueAddedTax $taxVAT): self{$this->taxVAT = $taxVAT;return $this;}public function getShippingTax(): ?ShippingTax{return $this->shippingTax;}public function setShippingTax(?ShippingTax $shippingTax): self{$this->shippingTax = $shippingTax;return $this;}public function getDeclaredValueTax(): ?float{return $this->declaredValueTax;}public function setDeclaredValueTax(?float $declaredValueTax): self{$this->declaredValueTax = $declaredValueTax;return $this;}public function getPapersFees(): ?float{return $this->papersFees;}public function setPapersFees(?float $papersFees): self{$this->papersFees = $papersFees;return $this;}public function getCodCashFees(): ?float{return $this->codCashFees;}public function setCodCashFees(?float $codCashFees): self{$this->codCashFees = $codCashFees;return $this;}public function getCodCheckOrBillFees(): ?float{return $this->codCheckOrBillFees;}public function setCodCheckOrBillFees(?float $codCheckOrBillFees): self{$this->codCheckOrBillFees = $codCheckOrBillFees;return $this;}/*** @return Collection<int, ShippingCalculationMethod>*/public function getCalculationMethods(): Collection{return $this->calculationMethods;}public function addCalculationMethod(ShippingCalculationMethod $calculationMethod): self{if (!$this->calculationMethods->contains($calculationMethod)) {$this->calculationMethods->add($calculationMethod);$calculationMethod->setShippingMethod($this);}return $this;}public function removeCalculationMethod(ShippingCalculationMethod $calculationMethod): self{if ($this->calculationMethods->removeElement($calculationMethod)) {// set the owning side to null (unless already changed)if ($calculationMethod->getShippingMethod() === $this) {$calculationMethod->setShippingMethod(null);}}return $this;}public function isIsTaxesIncludedInPrice(): ?bool{return $this->isTaxesIncludedInPrice;}public function setIsTaxesIncludedInPrice(?bool $isTaxesIncludedInPrice): self{$this->isTaxesIncludedInPrice = $isTaxesIncludedInPrice;return $this;}}