src/IlaveU/ShopBundle/Entity/Customer/Customer.php line 44

  1. <?php
  2. namespace App\IlaveU\ShopBundle\Entity\Customer;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  7. use App\Entity\User;
  8. use App\IlaveU\ShopBundle\Entity\Accounting\Invoice;
  9. use App\IlaveU\ShopBundle\Entity\Order\Order;
  10. use App\IlaveU\ShopBundle\Entity\Payment\BankBookItem;
  11. use App\IlaveU\ShopBundle\Entity\Product\Comment;
  12. use App\IlaveU\ShopBundle\Entity\Product\ProductSubscription;
  13. use App\IlaveU\ShopBundle\Entity\Promotion\Coupon;
  14. use App\IlaveU\ShopBundle\Entity\Shipping\CashOnDelivery;
  15. use App\IlaveU\ShopBundle\Entity\Shipping\CityRegion;
  16. use App\IlaveU\ShopBundle\Entity\Shipping\Shipment;
  17. use App\IlaveU\ShopBundle\Entity\Store\Store;
  18. use App\IlaveU\ShopBundle\Entity\Vendor\Vendor;
  19. use App\IlaveU\ShopBundle\Repository\Customer\CustomerRepository;
  20. use App\IlaveU\ShopBundle\Validator\Constraints\NotNegativeCredit;
  21. use Doctrine\Common\Collections\ArrayCollection;
  22. use Doctrine\Common\Collections\Collection;
  23. use Doctrine\ORM\Mapping as ORM;
  24. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  25. use Symfony\Component\Serializer\Annotation\Groups;
  26. use Symfony\Component\Validator\Constraints as Assert;
  27. use Gedmo\Mapping\Annotation as Gedmo;
  28. //use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  29. #[ApiResource(
  30.     normalizationContext: ['groups' => ['read','readPackEngagements']],
  31.     denormalizationContext: ['groups' => ['write']],
  32. )]
  33. #[ApiFilter(SearchFilter::class, properties: ['user.googleId' => 'exact','user.facebookId' => 'exact','firstName'=>'partial','lastName'=>'partial','phone'=>'partial'])]
  34. #[ApiFilter(OrderFilter::class, properties: ['firstName' => 'DESC'])]
  35. #[ORM\Entity(repositoryClassCustomerRepository::class)]
  36. #[UniqueEntity(fields: ['email'], message'This email is already in use.')]
  37. #[UniqueEntity(fields: ['phone'], message'This phone number is already in use.',groups:["create"])]
  38. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  39. #[NotNegativeCredit]
  40. class Customer implements \Stringable
  41. {
  42.     #[ORM\Id]
  43.     #[ORM\GeneratedValue]
  44.     #[ORM\Column(type'integer')]
  45.     #[Groups(["read","write"])]
  46.     private $id;
  47.     #[ORM\Column(type'text'nullabletrue)]
  48.     private ?string $description null;
  49.     #[Groups(["read","write"])]
  50.     #[ORM\Column(type'string'length255nullablefalseuniquetrue)]
  51.     #[Assert\Email]
  52.     #[Assert\NotNull]
  53.     #[Assert\NotBlank]
  54.     private ?string $email null;
  55.     #[ORM\Column(type'datetime'nullabletrue)]
  56.     private ?\DateTime $createdAt null;
  57.     #[Groups(["read","write"])]
  58.     #[ORM\Column(type'string'length255)]
  59.     private ?string $firstName null;
  60.     #[Groups(["read","write"])]
  61.     #[ORM\Column(type'string'length255)]
  62.     private ?string $lastName null;
  63.     #[Groups(["read","write"])]
  64.     #[ORM\Column(type'string'length255nullabletrue)]
  65.     private ?string $address null;
  66.     #[Groups(["read","write"])]
  67.     #[ORM\Column(type'string'length255nullabletrue)]
  68.     private $city;
  69.     #[Groups(["read","write"])]
  70.     #[ORM\Column(type'string'length255)]
  71.     #[Assert\Length(min8)]
  72.     private ?string $phone null;
  73.     #[Groups(["read","write"])]
  74.     #[ORM\Column(type'string'length255nullabletrue)]
  75.     private ?string $companyName null;
  76.     #[Groups(["read","write"])]
  77.     #[ORM\Column(type'string'length255nullabletrue)]
  78.     private ?string $addressIndication null;
  79.     #[Groups(["read","write"])]
  80.     #[ORM\Column(type'string'length255nullabletrue)]
  81.     private ?string $country null;
  82.     #[Groups(["read","write"])]
  83.     #[ORM\Column(type'string'length255nullabletrue)]
  84.     private ?string $postCode null;
  85.     
  86.     #[ORM\OneToMany(targetEntityOrder::class, mappedBy'customer'orphanRemovaltruecascade: ['persist''remove'])]
  87.     private \Doctrine\Common\Collections\Collection|array $orders;
  88.     #[Groups(["read","write"])]
  89.     #[ORM\ManyToOne(targetEntityCustomerGroup::class, inversedBy'customers'cascade: ['persist'])]
  90.     private ?\App\IlaveU\ShopBundle\Entity\Customer\CustomerGroup $customerGroup null;
  91.     #[Groups(["read","write"])]
  92.     #[ORM\OneToOne(targetEntityUser::class, orphanRemovaltruecascade: ['persist''remove'])]
  93.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  94.     private ?\App\Entity\User $user null;
  95.     #[ORM\OneToMany(targetEntityComment::class, mappedBy'customer')]
  96.     private \Doctrine\Common\Collections\Collection|array $comments;
  97.     #[Groups(["read","write"])]
  98.     #[ORM\Column(type'string'length255nullabletrue)]
  99.     private ?string $gender null;
  100.     #[Groups(["read","write"])]
  101.     #[ORM\Column(type'date'nullabletrue)]
  102.     private ?\DateTimeInterface $dateOfBirth null;
  103.     #[ORM\OneToMany(targetEntityCustomerAddress::class, mappedBy'customer'cascade: ['persist''remove'])]
  104.     private \Doctrine\Common\Collections\Collection|array $customerAddresses;
  105.     #[ORM\OneToMany(targetEntityCustomerWalletPoint::class, mappedBy'customer'orphanRemovaltruecascade: ['persist''remove'])]
  106.     private \Doctrine\Common\Collections\Collection|array $customerWalletPoints;
  107.     #[ORM\ManyToOne(targetEntityVendor::class, inversedBy'customers')]
  108.     private ?\App\IlaveU\ShopBundle\Entity\Vendor\Vendor $vendor null;
  109.     #[ORM\ManyToOne(targetEntityCityRegion::class)]
  110.     #[Groups(["read","write"])]
  111.     private $cityRegion;
  112.     #[ORM\OneToMany(targetEntityPackEngagement::class, mappedBy'customer'cascade: ['remove'], orphanRemovaltrue)]
  113.     private \Doctrine\Common\Collections\Collection|array $packEngagements;
  114.     #[Groups(["read","write"])]
  115.     #[ORM\Column(type'string'length255nullabletrue)]
  116.     private ?string $sponsorshipCode null;
  117.     #[Groups(["read","write"])]
  118.     #[ORM\Column(type'string'length255nullabletrue)]
  119.     private ?string $image null;
  120.     #[ORM\ManyToMany(targetEntityCoupon::class, mappedBy'allowedCustomers')]
  121.     private \Doctrine\Common\Collections\Collection|array $affectedCoupons;
  122.     #[ORM\OneToMany(targetEntityCoupon::class, mappedBy'onlyThisCustomer')]
  123.     private \Doctrine\Common\Collections\Collection|array $affectedCouponsOnlyForMe;
  124.         #[Groups(["read","write"])]
  125.     #[ORM\Column(type'boolean'nullabletrue)]
  126.     private $canReceiveMails;
  127.     #[Groups(["read","write"])]
  128.     #[ORM\Column(type'boolean'nullabletrue)]
  129.     private $canReceiveSms;
  130.     #[ORM\Column(type'string'length255nullabletrue)]
  131.     private $blindPassword;
  132.     #[ORM\Column(nullabletrue)]
  133.     private ?\DateTimeImmutable $deletedAt null;
  134.     #[ORM\OneToMany(mappedBy'senderCustomer'targetEntityShipment::class)]
  135.     private Collection $sentShipments;
  136.     #[ORM\OneToMany(mappedBy'recipientCustomer'targetEntityShipment::class)]
  137.     private Collection $receivedShipments;
  138.     #[ORM\OneToMany(mappedBy'customer'targetEntityBankBookItem::class)]
  139.     private Collection $bankBookItems;
  140.     #[ORM\OneToMany(mappedBy'customer'targetEntityCashOnDelivery::class)]
  141.     private Collection $cashOnDeliveries;
  142.     #[ORM\OneToMany(mappedBy'customer'targetEntityProductSubscription::class)]
  143.     #[Groups(["read","write"])]
  144.     private Collection $productSubscriptions;
  145.     #[Groups(["read","write"])]
  146.     #[ORM\ManyToOne(inversedBy'customers')]
  147.     private ?Store $store null;
  148.     // Undefined array key \"invoice\"" To be fixed for #[Groups(['read','write'])]
  149.     #[ORM\OneToMany(mappedBy'customer'targetEntityInvoice::class)]
  150.     private Collection $invoices;
  151.     #[ORM\Column(length255nullabletrue)]
  152.     #[Groups(["read","write"])]
  153.     private ?string $collectAddress null;
  154.     #[ORM\Column(length255nullabletrue)]
  155.     #[Groups(["read","write"])]
  156.     private ?string $shippingAddress null;
  157.     #[ORM\Column(length255nullabletrue)]
  158.     #[Groups(["read","write"])]
  159.     private ?string $collectLat null;
  160.     #[ORM\Column(length255nullabletrue)]
  161.     #[Groups(["read","write"])]
  162.     private ?string $collectLng null;
  163.     #[ORM\Column(length255nullabletrue)]
  164.     #[Groups(["read","write"])]
  165.     private ?string $shippingLng null;
  166.     #[ORM\OneToMany(mappedBy'customer'targetEntityComplaint::class)]
  167.     #[Groups(["read","write"])]
  168.     private Collection $complaints;
  169.     #[ORM\Column(nullabletrue)]
  170.     private ?array $metaData null;
  171.     #[Groups(["read","write"])]
  172.     #[ORM\Column(type'string'length50nullabletrue)]
  173.     private ?string $source null;
  174.    
  175.     public function __construct()
  176.     {
  177.         $this->sentShipments = new ArrayCollection();
  178.         $this->receivedShipments = new ArrayCollection();
  179.         $this->bankBookItems = new ArrayCollection();
  180.         $this->cashOnDeliveries = new ArrayCollection();
  181.         $this->productSubscriptions = new ArrayCollection();
  182.         $this->invoices = new ArrayCollection();
  183.         $this->customerWalletPoints = new ArrayCollection();
  184.         $this->createdAt = new \DateTime();
  185.         $this->complaints = new ArrayCollection();
  186.         $this->canReceiveMails true;
  187.         $this->canReceiveSms true;
  188.     }
  189.     public function __toString(): string
  190.     {
  191.         return $this->firstName." ".$this->lastName;
  192.     }
  193.     public function getId(): ?int
  194.     {
  195.         return $this->id;
  196.     }
  197.     public function getDescription(): ?string
  198.     {
  199.         return $this->description;
  200.     }
  201.     public function setDescription(?string $description): self
  202.     {
  203.         $this->description $description;
  204.         return $this;
  205.     }
  206.     public function getEmail(): ?string
  207.     {
  208.         return $this->email;
  209.     }
  210.     public function setEmail(?string $email): self
  211.     {
  212.         $this->email $email;
  213.         return $this;
  214.     }
  215.     public function getCreatedAt(): ?\DateTime
  216.     {
  217.         return $this->createdAt;
  218.     }
  219.     public function setCreatedAt(?\DateTime $createdAt): self
  220.     {
  221.         $this->createdAt $createdAt;
  222.         return $this;
  223.     }
  224.     public function getFirstName(): ?string
  225.     {
  226.         return $this->firstName;
  227.     }
  228.     public function setFirstName(string $firstName): self
  229.     {
  230.         $this->firstName $firstName;
  231.         return $this;
  232.     }
  233.     public function getLastName(): ?string
  234.     {
  235.         return $this->lastName;
  236.     }
  237.     public function setLastName(string $lastName): self
  238.     {
  239.         $this->lastName $lastName;
  240.         return $this;
  241.     }
  242.     public function getAddress(): ?string
  243.     {
  244.         return $this->address;
  245.     }
  246.     public function setAddress(?string $address): self
  247.     {
  248.         $this->address $address;
  249.         return $this;
  250.     }
  251.     public function getPhone(): ?string
  252.     {
  253.         return $this->phone;
  254.     }
  255.     public function setPhone(string $phone): self
  256.     {
  257.         $this->phone $phone;
  258.         return $this;
  259.     }
  260.     public function getCompanyName(): ?string
  261.     {
  262.         return $this->companyName;
  263.     }
  264.     public function setCompanyName(?string $companyName): self
  265.     {
  266.         $this->companyName $companyName;
  267.         return $this;
  268.     }
  269.     public function getAddressIndication(): ?string
  270.     {
  271.         return $this->addressIndication;
  272.     }
  273.     public function setAddressIndication(?string $addressIndication): self
  274.     {
  275.         $this->addressIndication $addressIndication;
  276.         return $this;
  277.     }
  278.     public function getCountry(): ?string
  279.     {
  280.         return $this->country;
  281.     }
  282.     public function setCountry(?string $country): self
  283.     {
  284.         $this->country $country;
  285.         return $this;
  286.     }
  287.     public function getPostCode(): ?string
  288.     {
  289.         return $this->postCode;
  290.     }
  291.     public function setPostCode(string $postCode): self
  292.     {
  293.         $this->postCode $postCode;
  294.         return $this;
  295.     }
  296.     /**
  297.      * @return Collection|Order[]
  298.      */
  299.     public function getOrders(): Collection
  300.     {
  301.         return $this->orders;
  302.     }
  303.     public function addOrder(Order $order): self
  304.     {
  305.         if (!$this->orders->contains($order)) {
  306.             $this->orders[] = $order;
  307.             $order->setCustomer($this);
  308.         }
  309.         return $this;
  310.     }
  311.     public function removeOrder(Order $order): self
  312.     {
  313.         if ($this->orders->removeElement($order)) {
  314.             // set the owning side to null (unless already changed)
  315.             if ($order->getCustomer() === $this) {
  316.                 $order->setCustomer(null);
  317.             }
  318.         }
  319.         return $this;
  320.     }
  321.     public function getCustomerGroup(): ?CustomerGroup
  322.     {
  323.         return $this->customerGroup;
  324.     }
  325.     public function setCustomerGroup(?CustomerGroup $customerGroup): self
  326.     {
  327.         $this->customerGroup $customerGroup;
  328.         return $this;
  329.     }
  330.     public function getUser(): ?User
  331.     {
  332.         return $this->user;
  333.     }
  334.     public function setUser(?User $user): self
  335.     {
  336.         $this->user $user;
  337.         return $this;
  338.     }
  339.     /**
  340.      * @return Collection|Comment[]
  341.      */
  342.     public function getComments(): Collection
  343.     {
  344.         return $this->comments;
  345.     }
  346.     public function addComment(Comment $comment): self
  347.     {
  348.         if (!$this->comments->contains($comment)) {
  349.             $this->comments[] = $comment;
  350.             $comment->setCustomer($this);
  351.         }
  352.         return $this;
  353.     }
  354.     public function removeComment(Comment $comment): self
  355.     {
  356.         if ($this->comments->removeElement($comment)) {
  357.             // set the owning side to null (unless already changed)
  358.             if ($comment->getCustomer() === $this) {
  359.                 $comment->setCustomer(null);
  360.             }
  361.         }
  362.         return $this;
  363.     }
  364.     public function getGender(): ?string
  365.     {
  366.         return $this->gender;
  367.     }
  368.     public function setGender(?string $gender): self
  369.     {
  370.         $this->gender $gender;
  371.         return $this;
  372.     }
  373.     public function getDateOfBirth(): ?\DateTimeInterface
  374.     {
  375.         return $this->dateOfBirth;
  376.     }
  377.     public function setDateOfBirth(?\DateTimeInterface $dateOfBirth): self
  378.     {
  379.         $this->dateOfBirth $dateOfBirth;
  380.         return $this;
  381.     }
  382.     /**
  383.      * @return Collection<int, CustomerAddress>
  384.      */
  385.     public function getCustomerAddresses(): Collection
  386.     {
  387.         return $this->customerAddresses;
  388.     }
  389.     public function addCustomerAddress(CustomerAddress $customerAddress): self
  390.     {
  391.         if (!$this->customerAddresses->contains($customerAddress)) {
  392.             $this->customerAddresses[] = $customerAddress;
  393.             $customerAddress->setCustomer($this);
  394.         }
  395.         return $this;
  396.     }
  397.     public function removeCustomerAddress(CustomerAddress $customerAddress): self
  398.     {
  399.         if ($this->customerAddresses->removeElement($customerAddress)) {
  400.             // set the owning side to null (unless already changed)
  401.             if ($customerAddress->getCustomer() === $this) {
  402.                 $customerAddress->setCustomer(null);
  403.             }
  404.         }
  405.         return $this;
  406.     }
  407.     /**
  408.      * @return Collection<int, CustomerWalletPoint>
  409.      */
  410.     public function getCustomerWalletPoints(): Collection
  411.     {
  412.         $filtered = new ArrayCollection();
  413.         foreach ($this->customerWalletPoints as $walletPoint) {
  414.             $originOrder $walletPoint->getOriginOrder();
  415.             if ($originOrder && $originOrder->getStatusShipping() === "annulee") {
  416.                 continue;
  417.             }
  418.             $filtered->add($walletPoint);
  419.         }
  420.         return $filtered;
  421.     }
  422.     public function addCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  423.     {
  424.         if (!$this->customerWalletPoints->contains($customerWalletPoint)) {
  425.             $this->customerWalletPoints[] = $customerWalletPoint;
  426.             $customerWalletPoint->setCustomer($this);
  427.         }
  428.         return $this;
  429.     }
  430.     public function removeCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  431.     {
  432.         if ($this->customerWalletPoints->removeElement($customerWalletPoint)) {
  433.             // set the owning side to null (unless already changed)
  434.             if ($customerWalletPoint->getCustomer() === $this) {
  435.                 $customerWalletPoint->setCustomer(null);
  436.             }
  437.         }
  438.         return $this;
  439.     }
  440.     #[Groups(["read","write"])]
  441.     public function getCredit(){
  442.         $credit 0;
  443.         foreach($this->getCustomerWalletPoints() as $singleWalletPoint){
  444.             if($singleWalletPoint->getOriginInvoice()){
  445.                 if($singleWalletPoint->getOriginInvoice()->getStatus() != "draft"){
  446.                     $credit $credit $singleWalletPoint->getPoints();
  447.                 }
  448.             }
  449.             
  450.             
  451.         }
  452.         return $credit;
  453.     }
  454.     #[Groups(["read","write"])]
  455.     public function getWalletCredit(){
  456.         $credit 0;
  457.         foreach($this->getCustomerWalletPoints() as $singleWalletPoint){
  458.             
  459.             if($singleWalletPoint->getOriginOrder()){
  460.                 $order $singleWalletPoint->getOriginOrder();
  461.                 if($order->getStatusShipping() == "annulee"){
  462.                     continue;
  463.                 }
  464.             }
  465.                     
  466.             $credit $credit $singleWalletPoint->getPoints();
  467.                 
  468.             
  469.             
  470.             
  471.         }
  472.         return $credit;
  473.     }
  474.     public function getVendor(): ?Vendor
  475.     {
  476.         return $this->vendor;
  477.     }
  478.     public function setVendor(?Vendor $vendor): self
  479.     {
  480.         $this->vendor $vendor;
  481.         return $this;
  482.     }
  483.     /**
  484.      * @return Collection<int, PackEngagement>
  485.      */
  486.     public function getPackEngagements(): Collection
  487.     {
  488.         return $this->packEngagements;
  489.     }
  490.     public function addPackEngagement(PackEngagement $packEngagement): self
  491.     {
  492.         if (!$this->packEngagements->contains($packEngagement)) {
  493.             $this->packEngagements[] = $packEngagement;
  494.             $packEngagement->setCustomer($this);
  495.         }
  496.         return $this;
  497.     }
  498.     public function removePackEngagement(PackEngagement $packEngagement): self
  499.     {
  500.         if ($this->packEngagements->removeElement($packEngagement)) {
  501.             // set the owning side to null (unless already changed)
  502.             if ($packEngagement->getCustomer() === $this) {
  503.                 $packEngagement->setCustomer(null);
  504.             }
  505.         }
  506.         return $this;
  507.     }
  508.     public function getSponsorshipCode(): ?string
  509.     {
  510.         return $this->sponsorshipCode;
  511.     }
  512.     public function setSponsorshipCode(?string $sponsorshipCode): self
  513.     {
  514.         $this->sponsorshipCode $sponsorshipCode;
  515.         return $this;
  516.     }
  517.     public function getMySponsorshipCode(){
  518.         return "PRN0000".$this->getId();
  519.     }
  520.     public function getImage(): ?string
  521.     {
  522.         return $this->image;
  523.     }
  524.     public function setImage(?string $image): self
  525.     {
  526.         $this->image $image;
  527.         return $this;
  528.     }
  529.     /**
  530.      * @return Collection<int, Coupon>
  531.      */
  532.     public function getAffectedCoupons(): Collection
  533.     {
  534.         return $this->affectedCoupons;
  535.     }
  536.     public function addAffectedCoupon(Coupon $affectedCoupon): self
  537.     {
  538.         if (!$this->affectedCoupons->contains($affectedCoupon)) {
  539.             $this->affectedCoupons[] = $affectedCoupon;
  540.             $affectedCoupon->addAllowedCustomer($this);
  541.         }
  542.         return $this;
  543.     }
  544.     public function removeAffectedCoupon(Coupon $affectedCoupon): self
  545.     {
  546.         if ($this->affectedCoupons->removeElement($affectedCoupon)) {
  547.             $affectedCoupon->removeAllowedCustomer($this);
  548.         }
  549.         return $this;
  550.     }
  551.     /**
  552.      * @return Collection<int, Coupon>
  553.      */
  554.     public function getAffectedCouponsOnlyForMe(): Collection
  555.     {
  556.         return $this->affectedCouponsOnlyForMe;
  557.     }
  558.     public function addAffectedCouponsOnlyForMe(Coupon $affectedCouponsOnlyForMe): self
  559.     {
  560.         if (!$this->affectedCouponsOnlyForMe->contains($affectedCouponsOnlyForMe)) {
  561.             $this->affectedCouponsOnlyForMe[] = $affectedCouponsOnlyForMe;
  562.             $affectedCouponsOnlyForMe->setOnlyThisCustomer($this);
  563.         }
  564.         return $this;
  565.     }
  566.     public function removeAffectedCouponsOnlyForMe(Coupon $affectedCouponsOnlyForMe): self
  567.     {
  568.         if ($this->affectedCouponsOnlyForMe->removeElement($affectedCouponsOnlyForMe)) {
  569.             // set the owning side to null (unless already changed)
  570.             if ($affectedCouponsOnlyForMe->getOnlyThisCustomer() === $this) {
  571.                 $affectedCouponsOnlyForMe->setOnlyThisCustomer(null);
  572.             }
  573.         }
  574.         return $this;
  575.     }
  576.     
  577.      
  578.     /**
  579.      * Get the value of canReceiveMails
  580.      */ 
  581.     public function getCanReceiveMails()
  582.     {
  583.         return $this->canReceiveMails;
  584.     }
  585.     /**
  586.      * Set the value of canReceiveMails
  587.      *
  588.      * @return  self
  589.      */ 
  590.     public function setCanReceiveMails($canReceiveMails)
  591.     {
  592.         $this->canReceiveMails $canReceiveMails;
  593.         return $this;
  594.     }
  595.     /**
  596.      * Get the value of canReceiveSms
  597.      */ 
  598.     public function getCanReceiveSms()
  599.     {
  600.         return $this->canReceiveSms;
  601.     }
  602.     /**
  603.      * Set the value of canReceiveSms
  604.      *
  605.      * @return  self
  606.      */ 
  607.     public function setCanReceiveSms($canReceiveSms)
  608.     {
  609.         $this->canReceiveSms $canReceiveSms;
  610.         return $this;
  611.     }
  612.     /**
  613.      * Get the value of blindPassword
  614.      */ 
  615.     public function getBlindPassword()
  616.     {
  617.         return $this->blindPassword;
  618.     }
  619.     /**
  620.      * Set the value of blindPassword
  621.      *
  622.      * @return  self
  623.      */ 
  624.     public function setBlindPassword($blindPassword)
  625.     {
  626.         $this->blindPassword $blindPassword;
  627.         return $this;
  628.     }
  629.     /**
  630.      * Get the value of city
  631.      */ 
  632.     public function getCity()
  633.     {
  634.         return $this->city;
  635.     }
  636.     /**
  637.      * Set the value of city
  638.      *
  639.      * @return  self
  640.      */ 
  641.     public function setCity($city)
  642.     {
  643.         $this->city $city;
  644.         return $this;
  645.     }
  646.     /**
  647.      * Get the value of cityRegion
  648.      */ 
  649.     public function getCityRegion()
  650.     {
  651.         return $this->cityRegion;
  652.     }
  653.     /**
  654.      * Set the value of cityRegion
  655.      *
  656.      * @return  self
  657.      */ 
  658.     public function setCityRegion($cityRegion)
  659.     {
  660.         $this->cityRegion $cityRegion;
  661.         return $this;
  662.     }
  663.     public function getDeletedAt(): ?\DateTimeImmutable
  664.     {
  665.         return $this->deletedAt;
  666.     }
  667.     public function setDeletedAt(?\DateTimeImmutable $deletedAt): self
  668.     {
  669.         $this->deletedAt $deletedAt;
  670.         return $this;
  671.     }
  672.     /**
  673.      * @return Collection<int, Shipment>
  674.      */
  675.     public function getSentShipments(): Collection
  676.     {
  677.         return $this->sentShipments;
  678.     }
  679.     public function addSentShipment(Shipment $sentShipment): self
  680.     {
  681.         if (!$this->sentShipments->contains($sentShipment)) {
  682.             $this->sentShipments->add($sentShipment);
  683.             $sentShipment->setSenderCustomer($this);
  684.         }
  685.         return $this;
  686.     }
  687.     public function removeSentShipment(Shipment $sentShipment): self
  688.     {
  689.         if ($this->sentShipments->removeElement($sentShipment)) {
  690.             // set the owning side to null (unless already changed)
  691.             if ($sentShipment->getSenderCustomer() === $this) {
  692.                 $sentShipment->setSenderCustomer(null);
  693.             }
  694.         }
  695.         return $this;
  696.     }
  697.     /**
  698.      * @return Collection<int, Shipment>
  699.      */
  700.     public function getReceivedShipments(): Collection
  701.     {
  702.         return $this->receivedShipments;
  703.     }
  704.     public function addReceivedShipment(Shipment $receivedShipment): self
  705.     {
  706.         if (!$this->receivedShipments->contains($receivedShipment)) {
  707.             $this->receivedShipments->add($receivedShipment);
  708.             $receivedShipment->setRecipientCustomer($this);
  709.         }
  710.         return $this;
  711.     }
  712.     public function removeReceivedShipment(Shipment $receivedShipment): self
  713.     {
  714.         if ($this->receivedShipments->removeElement($receivedShipment)) {
  715.             // set the owning side to null (unless already changed)
  716.             if ($receivedShipment->getRecipientCustomer() === $this) {
  717.                 $receivedShipment->setRecipientCustomer(null);
  718.             }
  719.         }
  720.         return $this;
  721.     }
  722.     /**
  723.      * @return Collection<int, BankBookItem>
  724.      */
  725.     public function getBankBookItems(): Collection
  726.     {
  727.         return $this->bankBookItems;
  728.     }
  729.     public function addBankBookItem(BankBookItem $bankBookItem): self
  730.     {
  731.         if (!$this->bankBookItems->contains($bankBookItem)) {
  732.             $this->bankBookItems->add($bankBookItem);
  733.             $bankBookItem->setCustomer($this);
  734.         }
  735.         return $this;
  736.     }
  737.     public function removeBankBookItem(BankBookItem $bankBookItem): self
  738.     {
  739.         if ($this->bankBookItems->removeElement($bankBookItem)) {
  740.             // set the owning side to null (unless already changed)
  741.             if ($bankBookItem->getCustomer() === $this) {
  742.                 $bankBookItem->setCustomer(null);
  743.             }
  744.         }
  745.         return $this;
  746.     }
  747.     /**
  748.      * @return Collection<int, CashOnDelivery>
  749.      */
  750.     public function getCashOnDeliveries(): Collection
  751.     {
  752.         return $this->cashOnDeliveries;
  753.     }
  754.     public function addCashOnDelivery(CashOnDelivery $cashOnDelivery): self
  755.     {
  756.         if (!$this->cashOnDeliveries->contains($cashOnDelivery)) {
  757.             $this->cashOnDeliveries->add($cashOnDelivery);
  758.             $cashOnDelivery->setCustomer($this);
  759.         }
  760.         return $this;
  761.     }
  762.     public function removeCashOnDelivery(CashOnDelivery $cashOnDelivery): self
  763.     {
  764.         if ($this->cashOnDeliveries->removeElement($cashOnDelivery)) {
  765.             // set the owning side to null (unless already changed)
  766.             if ($cashOnDelivery->getCustomer() === $this) {
  767.                 $cashOnDelivery->setCustomer(null);
  768.             }
  769.         }
  770.         return $this;
  771.     }
  772.     /**
  773.      * @return Collection<int, ProductSubscription>
  774.      */
  775.     public function getProductSubscriptions(): Collection
  776.     {
  777.         return $this->productSubscriptions;
  778.     }
  779.     public function addProductSubscription(ProductSubscription $productSubscription): self
  780.     {
  781.         if (!$this->productSubscriptions->contains($productSubscription)) {
  782.             $this->productSubscriptions->add($productSubscription);
  783.             $productSubscription->setCustomer($this);
  784.         }
  785.         return $this;
  786.     }
  787.     public function removeProductSubscription(ProductSubscription $productSubscription): self
  788.     {
  789.         if ($this->productSubscriptions->removeElement($productSubscription)) {
  790.             // set the owning side to null (unless already changed)
  791.             if ($productSubscription->getCustomer() === $this) {
  792.                 $productSubscription->setCustomer(null);
  793.             }
  794.         }
  795.         return $this;
  796.     }
  797.     public function getStore(): ?Store
  798.     {
  799.         return $this->store;
  800.     }
  801.     public function setStore(?Store $store): self
  802.     {
  803.         $this->store $store;
  804.         return $this;
  805.     }
  806.     /**
  807.      * @return Collection<int, Invoice>
  808.      */
  809.     public function getInvoices(): Collection
  810.     {
  811.         return $this->invoices;
  812.     }
  813.     public function addInvoice(Invoice $invoice): self
  814.     {
  815.         if (!$this->invoices->contains($invoice)) {
  816.             $this->invoices->add($invoice);
  817.             $invoice->setCustomer($this);
  818.         }
  819.         return $this;
  820.     }
  821.     public function removeInvoice(Invoice $invoice): self
  822.     {
  823.         if ($this->invoices->removeElement($invoice)) {
  824.             // set the owning side to null (unless already changed)
  825.             if ($invoice->getCustomer() === $this) {
  826.                 $invoice->setCustomer(null);
  827.             }
  828.         }
  829.         return $this;
  830.     }
  831.     public function getCollectAddress(): ?string
  832.     {
  833.         if(!$this->collectAddress){
  834.             return $this->getAddress();
  835.         }
  836.         return $this->collectAddress;
  837.     }
  838.     public function setCollectAddress(?string $collectAddress): self
  839.     {
  840.         
  841.         $this->collectAddress $collectAddress;
  842.         return $this;
  843.     }
  844.     public function getShippingAddress(): ?string
  845.     {
  846.         if(!$this->shippingAddress){
  847.             return $this->getAddress();
  848.         }
  849.         return $this->shippingAddress;
  850.     }
  851.     public function setShippingAddress(?string $shippingAddress): self
  852.     {
  853.         $this->shippingAddress $shippingAddress;
  854.         return $this;
  855.     }
  856.     public function getCollectLat(): ?string
  857.     {
  858.         return $this->collectLat;
  859.     }
  860.     public function setCollectLat(?string $collectLat): self
  861.     {
  862.         $this->collectLat $collectLat;
  863.         return $this;
  864.     }
  865.     public function getCollectLng(): ?string
  866.     {
  867.         return $this->collectLng;
  868.     }
  869.     public function setCollectLng(string $collectLng): self
  870.     {
  871.         $this->collectLng $collectLng;
  872.         return $this;
  873.     }
  874.     public function getShippingLng(): ?string
  875.     {
  876.         return $this->shippingLng;
  877.     }
  878.     public function setShippingLng(?string $shippingLng): self
  879.     {
  880.         $this->shippingLng $shippingLng;
  881.         return $this;
  882.     }
  883.     /**
  884.      * @return Collection<int, Complaint>
  885.      */
  886.     public function getComplaints(): Collection
  887.     {
  888.         return $this->complaints;
  889.     }
  890.     public function addComplaint(Complaint $complaint): self
  891.     {
  892.         if (!$this->complaints->contains($complaint)) {
  893.             $this->complaints->add($complaint);
  894.             $complaint->setCustomer($this);
  895.         }
  896.         return $this;
  897.     }
  898.     public function removeComplaint(Complaint $complaint): self
  899.     {
  900.         if ($this->complaints->removeElement($complaint)) {
  901.             // set the owning side to null (unless already changed)
  902.             if ($complaint->getCustomer() === $this) {
  903.                 $complaint->setCustomer(null);
  904.             }
  905.         }
  906.         return $this;
  907.     }
  908.     #[Groups(["read"])]
  909.     public function getFullName(){
  910.         return $this->firstName.' '.$this->lastName;
  911.     }
  912.     #[Groups(["read"])]
  913.     public function getFullNameWithPhone(){
  914.         return $this->firstName.' '.$this->lastName.' '.$this->phone;
  915.     }
  916.     public function getMetaData(): ?array
  917.     {
  918.         return $this->metaData;
  919.     }
  920.     public function setMetaData(?array $metaData): static
  921.     {
  922.         $this->metaData $metaData;
  923.         return $this;
  924.     }
  925.     
  926.     public function getTotalOrders(){
  927.         return count($this->getOrders());
  928.     }
  929.     public function getSource(): ?string
  930.     {
  931.         return $this->source;
  932.     }
  933.     public function setSource(?string $source): self
  934.     {
  935.         $this->source $source;
  936.         return $this;
  937.     }
  938. }