src/Flexy/ShopBundle/Entity/Order/Order.php line 45
<?php
namespace App\Flexy\ShopBundle\Entity\Order;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use App\Entity\LogHistory;
use App\Entity\User;
use App\Flexy\ShopBundle\Entity\Accounting\Invoice;
use App\Flexy\ShopBundle\Entity\Customer\Customer;
use App\Flexy\ShopBundle\Entity\Payment\ModalityPayment;
use App\Flexy\ShopBundle\Entity\Product\ProductSubscription;
use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
use App\Flexy\ShopBundle\Entity\Customer\CustomerWalletPoint;
use App\Flexy\ShopBundle\Entity\Payment\PaymentMethod;
use App\Flexy\ShopBundle\Entity\Promotion\Coupon;
use App\Flexy\ShopBundle\Entity\Shipping\CityRegion;
use App\Flexy\ShopBundle\Entity\Resource\Agent;
use App\Flexy\ShopBundle\Entity\Shipping\ShippingMethod;
use App\Flexy\ShopBundle\Entity\Store\Store;
use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
use App\Flexy\ShopBundle\Repository\Order\OrderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\InheritanceType;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
#[ApiResource(
normalizationContext: ['groups' => ['read']],
denormalizationContext: ['groups' => ['write']],
)]
#[ApiFilter(SearchFilter::class, properties: ['status' => 'exact','customer'=>'exact','statusShipping' => 'exact'])]
#[ORM\Table(name: '`order`')]
#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[InheritanceType('JOINED')]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
#[Gedmo\Loggable(logEntryClass:LogHistory::class)]
class Order implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
#[Groups(['read'])]
private $id;
#[Groups(['read'])]
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTime $createdAt = null;
#[Groups(['read','write'])]
#[ORM\Column(type: 'text', nullable: true)]
#[Gedmo\Versioned]
private ?string $description = null;
#[Groups(['read','write'])]
#[ORM\ManyToOne(targetEntity: Customer::class, inversedBy: 'orders', cascade: ['persist'])]
#[Assert\Valid]
#[Gedmo\Versioned]
private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer = null;
#[Groups(['read','write'])]
#[ORM\OneToMany(targetEntity: OrderItem::class, mappedBy: 'parentOrder', cascade: ['persist', 'remove'])]
#[Assert\Valid]
private \Doctrine\Common\Collections\Collection|array $orderItems;
#[ORM\OneToMany(targetEntity: Adjustment::class, mappedBy: 'parentOrder')]
private \Doctrine\Common\Collections\Collection|array $adjustments;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $firstName = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $lastName = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $companyName = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $address = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $city = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $country = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $department = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $postcode = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $email = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $tel = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $comment = null;
#[ORM\ManyToOne(targetEntity: DemandeFund::class, inversedBy: 'orders')]
private ?\App\Flexy\ShopBundle\Entity\Order\DemandeFund $demandeFund = null;
#[Groups(['read','write'])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Gedmo\Versioned]
private ?string $status = "draft";
#[Groups(['read','write'])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Gedmo\Versioned]
private ?string $statusShipping = "draft";
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $source = null;
#[ORM\Column(type: 'text', nullable: true)]
private $deliveryAt;
#[ORM\Column(type: 'text', nullable: true)]
private $recoveryAt;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $oldOrderNumber = null;
#[ORM\Column(type: 'float', nullable: true)]
private ?float $reduction = null;
#[ORM\Column(type: 'float', nullable: true)]
private $distance = 0;
#[ORM\ManyToOne(targetEntity: ShippingMethod::class, inversedBy: 'orders', cascade: ['persist'])]
#[Groups(['read','write'])]
#[Gedmo\Versioned]
private ?\App\Flexy\ShopBundle\Entity\Shipping\ShippingMethod $shippingMethod = null;
#[ORM\ManyToOne(targetEntity: Agent::class, inversedBy: 'orders')]
#[Groups(['read','write'])]
#[Gedmo\Versioned]
private ?\App\Flexy\ShopBundle\Entity\Resource\Agent $agent = null;
#[Groups(['read','write'])]
#[ORM\ManyToOne(targetEntity: paymentMethod::class, inversedBy: 'orders', cascade: ['persist'])]
#[ORM\JoinColumn(nullable: true, onDelete: 'CASCADE')]
private ?\App\Flexy\ShopBundle\Entity\Payment\PaymentMethod $paymentMethod = null;
#[ORM\Column(type: 'float', nullable: true)]
#[Groups(['read','write'])]
#[Gedmo\Versioned]
private ?float $payedAmount = null;
#[ORM\Column(type: 'datetime', nullable: true)]
#[Groups(['read','write'])]
#[Gedmo\Versioned]
private ?\DateTimeInterface $startProcessingAt = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $deliveryType = null;
#[ORM\Column(type: 'datetime', nullable: true)]
#[Groups(['read','write'])]
#[Gedmo\Versioned]
private ?\DateTimeInterface $startDeliveryAt = null;
#[ORM\OneToMany(targetEntity: CustomerWalletPoint::class, cascade: ['persist', 'remove'], orphanRemoval: true, mappedBy: 'originOrder')]
private \Doctrine\Common\Collections\Collection|array $customerWalletPoints;
#[ORM\ManyToOne(targetEntity: Coupon::class, inversedBy: 'orders')]
#[Groups(['read','write'])]
private ?\App\Flexy\ShopBundle\Entity\Promotion\Coupon $coupon = null;
#[ORM\ManyToOne(targetEntity: Agent::class, inversedBy: 'ordersToDolist')]
private ?\App\Flexy\ShopBundle\Entity\Resource\Agent $agentToDo = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $isToDo = null;
#[ORM\ManyToOne(targetEntity: CityRegion::class, inversedBy: 'orders')]
private ?\App\Flexy\ShopBundle\Entity\Shipping\CityRegion $cityRegionShipping = null;
#[ORM\ManyToOne(targetEntity: CityRegion::class, inversedBy: 'collectedOrders')]
private $cityRegionCollect;
#[ORM\ManyToOne(targetEntity: Vendor::class, inversedBy: 'orders')]
private ?\App\Flexy\ShopBundle\Entity\Vendor\Vendor $vendor = null;
#[ORM\Column(type: 'text', nullable: true)]
#[Groups(['read','write'])]
private ?string $collectAddress = null;
#[ORM\Column(type: 'text', nullable: true)]
#[Groups(['read','write'])]
private ?string $shippingAddress = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $collectTel = null;
#[ORM\Column(type: 'boolean', nullable: true)]
#[Groups(['read','write'])]
private ?bool $isHeavy = null;
#[Groups(['read','write'])]
#[ORM\Column(type: 'float', nullable: true)]
private $shippingTips = 0;
#[Groups(['read','write'])]
#[ORM\Column(type: 'float', nullable: true)]
private $walletPaymentAmount = 0;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isChecked;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $tokenStripe;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['read','write'])]
private ?string $orderType = "order";
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $deletedAt = null;
#[ORM\ManyToOne(inversedBy: 'orders')]
private ?Store $store = null;
#[ORM\OneToOne(inversedBy: 'relatedOrder', cascade: ['persist', 'remove'])]
private ?Shipment $shipment = null;
#[ORM\ManyToOne(inversedBy: 'orders')]
private ?Invoice $invoice = null;
#[ORM\Column(type: Types::STRING,nullable: true)]
#[Gedmo\Blameable(on: 'create')]
private $createdBy;
#[ORM\OneToOne(mappedBy: 'relatedOrder', cascade: ['persist', 'remove'])]
private ?ProductSubscription $productSubscription = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $qr_image = null;
#[ORM\OneToMany(mappedBy: 'parent_order_ticket', targetEntity: TicketsCustomer::class)]
private Collection $ticketsCustomers;
#[ORM\Column(length: 255, nullable: true)]
private ?string $status_server = null;
#[ORM\OneToMany(mappedBy: 'order_source', cascade: ['persist', 'remove'], orphanRemoval: true, targetEntity: ModalityPayment::class)]
private Collection $modalityPayments;
#[ORM\OneToOne(inversedBy: 'usedByOrder', targetEntity: self::class, cascade: ['persist', 'remove'])]
private ?self $originOrder = null;
#[ORM\OneToOne(mappedBy: 'originOrder', targetEntity: self::class, cascade: ['persist', 'remove'])]
private ?self $usedByOrder = null;
#[ORM\Column(nullable: true)]
private ?int $invoiceNumber = null;
#[ORM\Column(nullable: true)]
private ?float $reduction_meat = null;
#[ORM\OneToMany(mappedBy: 'sourceOrder', targetEntity: NotificationOrder::class)]
private Collection $notificationOrders;
#[ORM\Column(nullable: true)]
private ?int $nbrPerson = null;
public function __construct()
{
$this->orderItems = new ArrayCollection();
$this->adjustments = new ArrayCollection();
$this->createdAt = new \DateTime();
$this->customerWalletPoints = new ArrayCollection();
$this->ticketsCustomers = new ArrayCollection();
$this->modalityPayments = new ArrayCollection();
$this->notificationOrders = new ArrayCollection();
}
public function __clone()
{
$this->id = null; // RƩinitialiser l'ID
$this->originOrder = null;
$this->shipment= null;
$this->createdAt = new \DateTime();
}
public function __toString(): string
{
return $this->getOrderNumber();
}
public function getId(): ?int
{
return $this->id;
}
#[Groups(['read'])]
public function getOrderNumber($secondaryPrefix=null)
{
$prefix = "CMD-";
if($this->getOrderType()=="invoice"){
$prefix = "FA-";
}else if($this->getOrderType()=="quote"){
$prefix = "DEV-";
}
$orderNumber = $prefix.$this->createdAt->format("y"). (int) $this->createdAt->format("m").str_pad((string) $this->id, 3, "0", STR_PAD_LEFT);
if($secondaryPrefix){
$orderNumber = $prefix.$this->createdAt->format("y"). (int) $this->createdAt->format("m").str_pad((string) $this->id, 3, "0", STR_PAD_LEFT)."-".$secondaryPrefix;
}
return $orderNumber;
}
public function getOrderNumberFormatted()
{
if($this->getOrderType()=="invoice"){
$prefix = "FA-";
}else if($this->getOrderType()=="quote"){
$prefix = "DEV-";
}else{
$prefix = "CMD-";
}
return $prefix.$this->createdAt->format("ym").str_pad($this->getOrderNumber(), 8, '0', STR_PAD_LEFT);
}
public function getIdPrefixedInvoice()
{
$prefix = "FA-";
if(!$this->invoiceNumber){
return "";
}
return $prefix.str_pad($this->getInvoiceNumber(), 5, '0', STR_PAD_LEFT);
}
#[Groups(['read'])]
public function getIdPrefixed()
{
return $this->getOrderNumber();
}
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getCategoriesProduct(){
$categories = [];
foreach($this->getOrderItems() as $singleOrderItem){
if($singleOrderItem->getProduct()){
if($singleOrderItem->getProduct()->getParentCategory()){
$categories[] = $singleOrderItem->getProduct()->getParentCategory()->getName();
}
}
}
return $categories;
}
public function getSubCategoriesProduct(){
$categories = [];
foreach($this->getOrderItems() as $singleOrderItem){
if($singleOrderItem->getProduct()){
foreach($singleOrderItem->getProduct()->getCategoriesProduct() as $singleCategory){
if(!in_array($singleCategory->getName(),$categories)){
$categories[] = $singleCategory->getName();
}
}
}
}
return $categories;
}
/**
* @return Collection|OrderItem[]
*/
public function getOrderItems(): Collection
{
return $this->orderItems;
}
public function addOrderItem(OrderItem $orderItem): self
{
if (!$this->orderItems->contains($orderItem)) {
$this->orderItems[] = $orderItem;
$orderItem->setParentOrder($this);
}
return $this;
}
public function removeOrderItem(OrderItem $orderItem): self
{
if ($this->orderItems->removeElement($orderItem)) {
// set the owning side to null (unless already changed)
if ($orderItem->getParentOrder() === $this) {
$orderItem->setParentOrder(null);
}
}
return $this;
}
/**
* @return Collection|Adjustment[]
*/
public function getAdjustments(): Collection
{
return $this->adjustments;
}
public function addAdjustment(Adjustment $adjustment): self
{
if (!$this->adjustments->contains($adjustment)) {
$this->adjustments[] = $adjustment;
$adjustment->setParentOrder($this);
}
return $this;
}
public function removeAdjustment(Adjustment $adjustment): self
{
if ($this->adjustments->removeElement($adjustment)) {
// set the owning side to null (unless already changed)
if ($adjustment->getParentOrder() === $this) {
$adjustment->setParentOrder(null);
}
}
return $this;
}
#[Groups(['read'])]
public function getReductionOnCoupon(){
$reductionCoupon=0;
if($this->getCoupon()){
if($this->getCoupon()->getTypeReduction()=="percent"){
$reductionCoupon = ($this->getTotalAmount()/100)*$this->getCoupon()->getValueReduction();
}else{
$reductionCoupon = $this->getCoupon()->getValueReduction();
}
}
return number_format($reductionCoupon,2,",","");
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): self
{
$this->address = $address;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): self
{
$this->city = $city;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(string $country): self
{
$this->country = $country;
return $this;
}
public function getDepartment(): ?string
{
return $this->department;
}
public function setDepartment(?string $department): self
{
$this->department = $department;
return $this;
}
public function getPostcode(): ?string
{
return $this->postcode;
}
public function setPostcode(?string $postcode): self
{
$this->postcode = $postcode;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(string $tel): self
{
$this->tel = $tel;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
#[Groups(['read'])]
public function getTotalAmount(){
$total=0;
foreach($this->orderItems as $singleOrderItem){
$total = $total + ($singleOrderItem->getTotalAmount());
}
return $total;
}
#[Groups(['read'])]
public function getFullTotalAmount(){
$total = ((float)$this->getTotalAmount() + (float)$this->getShippingFees() + (float)$this->getShippingTips()) - (float)$this->getReductionOnCoupon() - (float)$this->getWalletPaymentAmount() ;
return $total;
}
//needs optimisation
#[Groups(['read'])]
public function getShippingFees(){
$fees = 0;
if($this->getShippingMethod()){
if($this->getShippingMethod()->isIsSeparatelyCalculated()){
$fees = $this->getShippingMethod()->getPrice();
foreach($this->getShippingMethod()->getShippingRules() as $shippingRule){
if($shippingRule->getTypeCalculation() == "distance"){
if( $shippingRule->getMin() < $this->getDistance() and $shippingRule->getMax() >= $this->getDistance() ){
$fees = $this->getDistance() * $shippingRule->getValueCalculation();
/*Condition for TLCS may be it works for all people*/
if ($fees < $this->getShippingMethod()->getPrice()){
$fees = $this->getShippingMethod()->getPrice();
}
/*Condition for TLCS may be it works for all people*/
}
}
else{
if(
$shippingRule->getMin() < $this->getTotalAmount() and $shippingRule->getMax() >= $this->getTotalAmount()
){
if($shippingRule->getTypeCalculation() == "percent"){
$fees = ($this->getTotalAmount() / 100 ) * $shippingRule->getValueCalculation();
}
else{
$fees = $shippingRule->getValueCalculation();
}
}
}
}
}
}
return $fees;
}
#[Groups(['read'])]
public function getTotalReduction(){
$total=0;
foreach($this->orderItems as $singleOrderItem){
$total = $total + ($singleOrderItem->getReduction());
}
return $total;
}
public function getReductionOnTotal(){
$reductionAmount = 0;
if($this->getReduction() and $this->getReduction()>0){
$reductionAmount = ($this->getTotalAmount() / 100) * $this->getReduction();
}
return $reductionAmount;
}
#[Groups(['read'])]
public function getAmountPayedByCredit(){
$total=0;
foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
if($singleWalletPoints->getPoints()<0){
$total = $total + ($singleWalletPoints->getPoints());
}
}
return $total;
}
#[Groups(['read'])]
public function getAmountEarnedAsCredit(){
$total=0;
foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
if($singleWalletPoints->getPoints()>0){
$total = $total + ($singleWalletPoints->getPoints());
}
}
return $total;
}
public function getDemandeFund(): ?DemandeFund
{
return $this->demandeFund;
}
public function setDemandeFund(?DemandeFund $demandeFund): self
{
$this->demandeFund = $demandeFund;
return $this;
}
public function getStatus(): ?string
{
$status = "order_finance_verification_pending";
if($this->status)
{
$status = $this->status;
}
return $status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
// BySamir : TO CLEAN
public function getSource(): ?string
{
return $this->source;
}
public function setSource(?string $source): self
{
$this->source = $source;
return $this;
}
public function getDeliveryAt()
{
return $this->deliveryAt;
}
public function setDeliveryAt($deliveryAt)
{
$this->deliveryAt = $deliveryAt;
return $this;
}
public function getRecoveryAt()
{
return $this->recoveryAt;
}
public function setRecoveryAt($recoveryAt)
{
$this->recoveryAt = $recoveryAt;
return $this;
}
public function getReduction(): ?float
{
return $this->reduction;
}
public function setReduction(?float $reduction): self
{
$this->reduction = $reduction;
return $this;
}
public function getShippingMethod(): ?ShippingMethod
{
return $this->shippingMethod;
}
public function setShippingMethod(?ShippingMethod $shippingMethod): self
{
$this->shippingMethod = $shippingMethod;
return $this;
}
public function getAgent(): ?Agent
{
return $this->agent;
}
public function setAgent(?Agent $agent): self
{
$this->agent = $agent;
return $this;
}
public function getPaymentMethod(): ?paymentMethod
{
return $this->paymentMethod;
}
public function setPaymentMethod(?paymentMethod $paymentMethod): self
{
$this->paymentMethod = $paymentMethod;
return $this;
}
public function getPayedAmount(): ?float
{
return $this->payedAmount;
}
public function setPayedAmount(?float $payedAmount): self
{
$this->payedAmount = $payedAmount;
return $this;
}
public function getStartProcessingAt(): ?\DateTimeInterface
{
return $this->startProcessingAt;
}
public function setStartProcessingAt(?\DateTimeInterface $startProcessingAt): self
{
$this->startProcessingAt = $startProcessingAt;
return $this;
}
public function getDeliveryType(): ?string
{
return $this->deliveryType;
}
public function setDeliveryType(?string $deliveryType): self
{
$this->deliveryType = $deliveryType;
return $this;
}
public function getStartDeliveryAt(): ?\DateTimeInterface
{
return $this->startDeliveryAt;
}
public function setStartDeliveryAt(?\DateTimeInterface $startDeliveryAt): self
{
$this->startDeliveryAt = $startDeliveryAt;
return $this;
}
/**
* @return Collection<int, CustomerWalletPoint>
*/
public function getCustomerWalletPoints(): Collection
{
return $this->customerWalletPoints;
}
public function addCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
{
if (!$this->customerWalletPoints->contains($customerWalletPoint)) {
$this->customerWalletPoints[] = $customerWalletPoint;
$customerWalletPoint->setOriginOrder($this);
}
return $this;
}
public function removeCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
{
if ($this->customerWalletPoints->removeElement($customerWalletPoint)) {
// set the owning side to null (unless already changed)
if ($customerWalletPoint->getOriginOrder() === $this) {
$customerWalletPoint->setOriginOrder(null);
}
}
return $this;
}
public function getCoupon(): ?Coupon
{
return $this->coupon;
}
public function setCoupon(?Coupon $coupon): self
{
$this->coupon = $coupon;
return $this;
}
public function getAgentToDo(): ?Agent
{
return $this->agentToDo;
}
public function setAgentToDo(?Agent $agentToDo): self
{
$this->agentToDo = $agentToDo;
return $this;
}
public function getIsToDo(): ?bool
{
return $this->isToDo;
}
public function setIsToDo(?bool $isToDo): self
{
$this->isToDo = $isToDo;
return $this;
}
public function getCityRegionShipping(): ?CityRegion
{
return $this->cityRegionShipping;
}
public function setCityRegionShipping(?CityRegion $cityRegionShipping): self
{
$this->cityRegionShipping = $cityRegionShipping;
return $this;
}
public function getVendor(): ?Vendor
{
return $this->vendor;
}
public function setVendor(?Vendor $vendor): self
{
$this->vendor = $vendor;
return $this;
}
public function getCollectAddress(): ?string
{
return $this->collectAddress;
}
public function setCollectAddress(?string $collectAddress): self
{
$this->collectAddress = $collectAddress;
return $this;
}
public function getCollectTel(): ?string
{
return $this->collectTel;
}
public function setCollectTel(?string $collectTel): self
{
$this->collectTel = $collectTel;
return $this;
}
public function getIsHeavy(): ?bool
{
return $this->isHeavy;
}
public function setIsHeavy(?bool $isHeavy): self
{
$this->isHeavy = $isHeavy;
return $this;
}
#[Groups(['read'])]
public function getShippingTips(): ?float
{
return $this->shippingTips;
}
public function setShippingTips(?float $shippingTips): self
{
$this->shippingTips = $shippingTips;
return $this;
}
/**
* Get the value of isChecked
*/
public function getIsChecked()
{
return $this->isChecked;
}
/**
* Set the value of isChecked
*
* @return self
*/
public function setIsChecked($isChecked)
{
$this->isChecked = $isChecked;
return $this;
}
/**
* Get the value of walletPaymentAmount
*/
public function getWalletPaymentAmount()
{
return $this->walletPaymentAmount;
}
/**
* Set the value of walletPaymentAmount
*
* @return self
*/
public function setWalletPaymentAmount($walletPaymentAmount)
{
$this->walletPaymentAmount = $walletPaymentAmount;
return $this;
}
/**
* Get the value of cityRegionCollect
*/
public function getCityRegionCollect()
{
return $this->cityRegionCollect;
}
/**
* Set the value of cityRegionCollect
*
* @return self
*/
public function setCityRegionCollect($cityRegionCollect)
{
$this->cityRegionCollect = $cityRegionCollect;
return $this;
}
/**
* Get the value of distance
*/
public function getDistance()
{
return $this->distance;
}
/**
* Set the value of distance
*
* @return self
*/
public function setDistance($distance)
{
$this->distance = $distance;
return $this;
}
/**
* Get the value of tokenStripe
*/
public function getTokenStripe()
{
return $this->tokenStripe;
}
/**
* Set the value of tokenStripe
*
* @return self
*/
public function setTokenStripe($tokenStripe)
{
$this->tokenStripe = $tokenStripe;
return $this;
}
public function getOrderType(): ?string
{
return $this->orderType;
}
public function setOrderType(?string $orderType): self
{
$this->orderType = $orderType;
return $this;
}
/**
* Get the value of deletedAt
*/
public function getDeletedAt()
{
return $this->deletedAt;
}
/**
* Set the value of deletedAt
*
* @return self
*/
public function setDeletedAt($deletedAt)
{
$this->deletedAt = $deletedAt;
return $this;
}
public function getStore(): ?Store
{
return $this->store;
}
public function setStore(?Store $store): self
{
$this->store = $store;
return $this;
}
public function getShipment(): ?Shipment
{
return $this->shipment;
}
public function setShipment(?Shipment $shipment): self
{
$this->shipment = $shipment;
return $this;
}
public function getInvoice(): ?Invoice
{
return $this->invoice;
}
public function setInvoice(?Invoice $invoice): self
{
$this->invoice = $invoice;
return $this;
}
/**
* Get the value of shippingAddress
*/
public function getShippingAddress()
{
return $this->shippingAddress;
}
/**
* Set the value of shippingAddress
*
* @return self
*/
public function setShippingAddress($shippingAddress)
{
$this->shippingAddress = $shippingAddress;
return $this;
}
public function getCreatedBy()
{
return $this->createdBy;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
#[Groups(['read'])]
public function getStartProcessingAtText()
{
$value = null;
if($this->startDeliveryAt){
$intervalDate = clone $this->startProcessingAt;
$intervalInMinutes = $this->shippingMethod->getShippingDuration() * 60;
$intervalDate->modify(" + ".$intervalInMinutes." minutes");
$value = $this->startProcessingAt->format("Y-m-d H:i") ." - ".$intervalDate->format("H:i");
}
return $value;
}
#[Groups(['read'])]
public function getStartDeliveryAtText()
{
$value = null;
if($this->startDeliveryAt){
$intervalDate = clone $this->startDeliveryAt;
$intervalInMinutes = $this->shippingMethod->getShippingDuration() * 60;
$intervalDate->modify(" + ".$intervalInMinutes." minutes");
$value = $this->startDeliveryAt->format("Y-m-d H:i") ." - ".$intervalDate->format("H:i");
}
return $value;
}
#[Groups(['read'])]
public function getShippingMethodText()
{
$value = null;
if($this->shippingMethod){
$value = $this->shippingMethod->getName();
}
return $value;
}
#[Groups(['read'])]
public function getPaymentMethodText()
{
$value = null;
if($this->paymentMethod){
$value = $this->paymentMethod->getName();
}
return $value;
}
#[Groups(['read'])]
public function getTotalProducts()
{
$value = 0;
foreach($this->getOrderItems() as $singleOrderItem){
$value = $value + $singleOrderItem->getQuantity();
}
return $value;
}
public function getProductSubscription(): ?ProductSubscription
{
return $this->productSubscription;
}
public function setProductSubscription(?ProductSubscription $productSubscription): self
{
// unset the owning side of the relation if necessary
if ($productSubscription === null && $this->productSubscription !== null) {
$this->productSubscription->setRelatedOrder(null);
}
// set the owning side of the relation if necessary
if ($productSubscription !== null && $productSubscription->getRelatedOrder() !== $this) {
$productSubscription->setRelatedOrder($this);
}
$this->productSubscription = $productSubscription;
return $this;
}
/**
* Get the value of statusShipping
*/
public function getStatusShipping()
{
return $this->statusShipping;
}
/**
* Set the value of statusShipping
*
* @return self
*/
public function setStatusShipping($statusShipping)
{
$this->statusShipping = $statusShipping;
return $this;
}
public function getQrImage(): ?string
{
return $this->qr_image;
}
public function setQrImage(?string $qr_image): static
{
$this->qr_image = $qr_image;
return $this;
}
public function getOriginOrder(): ?self
{
return $this->originOrder;
}
public function setOriginOrder(?self $originOrder): static
{
$this->originOrder = $originOrder;
return $this;
}
/**
* @return Collection<int, TicketsCustomer>
*/
public function getTicketsCustomers(): Collection
{
return $this->ticketsCustomers;
}
public function addTicketsCustomer(TicketsCustomer $ticketsCustomer): static
{
if (!$this->ticketsCustomers->contains($ticketsCustomer)) {
$this->ticketsCustomers->add($ticketsCustomer);
$ticketsCustomer->setParentOrderTicket($this);
}
return $this;
}
public function removeTicketsCustomer(TicketsCustomer $ticketsCustomer): static
{
if ($this->ticketsCustomers->removeElement($ticketsCustomer)) {
// set the owning side to null (unless already changed)
if ($ticketsCustomer->getParentOrderTicket() === $this) {
$ticketsCustomer->setParentOrderTicket(null);
}
}
return $this;
}
public function getStatusServer(): ?string
{
return $this->status_server;
}
public function setStatusServer(?string $status_server): static
{
$this->status_server = $status_server;
return $this;
}
public function getUsedByOrder(): ?self
{
return $this->usedByOrder;
}
public function setUsedByOrder(?self $usedByOrder): static
{
// unset the owning side of the relation if necessary
if ($usedByOrder === null && $this->usedByOrder !== null) {
$this->usedByOrder->setOriginOrder(null);
}
// set the owning side of the relation if necessary
if ($usedByOrder !== null && $usedByOrder->getOriginOrder() !== $this) {
$usedByOrder->setOriginOrder($this);
}
$this->usedByOrder = $usedByOrder;
return $this;
}
public function getInvoiceNumber(): ?int
{
if(!$this->invoiceNumber){
//return $this->getId();
}
return $this->invoiceNumber;
}
public function setInvoiceNumber(?int $invoiceNumber): static
{
$this->invoiceNumber = $invoiceNumber;
return $this;
}
/**
* @return Collection<int, ModalityPayment>
*/
public function getModalityPayments(): Collection
{
return $this->modalityPayments;
}
public function addModalityPayment(ModalityPayment $modalityPayment): static
{
/*if (!$this->modalityPayments->contains($modalityPayment)) {
$this->modalityPayments->add($modalityPayment);
$modalityPayment->setOrderSource($this);
}*/
if (!$this->modalityPayments->contains($modalityPayment)) {
$this->modalityPayments->add($modalityPayment);
}
// Assurer que ModalityPayment connaƮt bien son Order source
$modalityPayment->setOrderSource($this);
return $this;
}
public function removeModalityPayment(ModalityPayment $modalityPayment): static
{
if ($this->modalityPayments->removeElement($modalityPayment)) {
// set the owning side to null (unless already changed)
if ($modalityPayment->getOrderSource() === $this) {
$modalityPayment->setOrderSource(null);
}
}
return $this;
}
public function getReductionMeat(): ?float
{
return $this->reduction_meat;
}
public function setReductionMeat(?float $reduction_meat): static
{
$this->reduction_meat = $reduction_meat;
return $this;
}
/**
* @return Collection<int, NotificationOrder>
*/
public function getNotificationOrders(): Collection
{
return $this->notificationOrders;
}
public function addNotificationOrder(NotificationOrder $notificationOrder): static
{
if (!$this->notificationOrders->contains($notificationOrder)) {
$this->notificationOrders->add($notificationOrder);
$notificationOrder->setSourceOrder($this);
}
return $this;
}
public function removeNotificationOrder(NotificationOrder $notificationOrder): static
{
if ($this->notificationOrders->removeElement($notificationOrder)) {
// set the owning side to null (unless already changed)
if ($notificationOrder->getSourceOrder() === $this) {
$notificationOrder->setSourceOrder(null);
}
}
return $this;
}
public function getNbrPerson(): ?int
{
return $this->nbrPerson;
}
public function setNbrPerson(?int $nbrPerson): static
{
$this->nbrPerson = $nbrPerson;
return $this;
}
}