src/Flexy/ShopBundle/Entity/Customer/Customer.php line 42
<?php
namespace App\Flexy\ShopBundle\Entity\Customer;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use App\Entity\User;
use App\Flexy\ShopBundle\Entity\Accounting\Invoice;
use App\Flexy\ShopBundle\Entity\Order\Order;
use App\Flexy\ShopBundle\Entity\Payment\BankBookItem;
use App\Flexy\ShopBundle\Entity\Product\Comment;
use App\Flexy\ShopBundle\Entity\Product\ProductSubscription;
use App\Flexy\ShopBundle\Entity\Promotion\Coupon;
use App\Flexy\ShopBundle\Entity\Shipping\CashOnDelivery;
use App\Flexy\ShopBundle\Entity\Shipping\CityRegion;
use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
use App\Flexy\ShopBundle\Entity\Store\Store;
use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
use App\Flexy\ShopBundle\Repository\Customer\CustomerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
//use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
#[ApiResource(
normalizationContext: ['groups' => ['read','readPackEngagements']],
denormalizationContext: ['groups' => ['write']],
)]
#[ApiFilter(SearchFilter::class, properties: ['user.googleId' => 'exact','user.facebookId' => 'exact','firstName'=>'partial','lastName'=>'partial','phone'=>'partial'])]
#[ApiFilter(OrderFilter::class, properties: ['firstName' => 'DESC'])]
#[ORM\Entity(repositoryClass: CustomerRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'This email is already in use.')]
#[UniqueEntity(fields: ['phone'], message: 'This phone number is already in use.',groups:["create"])]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class Customer implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
#[Groups(["read","write"])]
private $id;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: false, unique: true)]
#[Assert\Email]
#[Assert\NotNull]
#[Assert\NotBlank]
private ?string $email = null;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTime $createdAt = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255)]
private ?string $firstName = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255)]
private ?string $lastName = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $address = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $city;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255)]
#[Assert\Length(min: 8)]
private ?string $phone = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $companyName = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $addressIndication = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $country = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $postCode = null;
#[ORM\OneToMany(targetEntity: Order::class, mappedBy: 'customer', orphanRemoval: true, cascade: ['persist', 'remove'])]
private \Doctrine\Common\Collections\Collection|array $orders;
#[Groups(["read","write"])]
#[ORM\ManyToOne(targetEntity: CustomerGroup::class, inversedBy: 'customers', cascade: ['persist'])]
private ?\App\Flexy\ShopBundle\Entity\Customer\CustomerGroup $customerGroup = null;
#[Groups(["read","write"])]
#[ORM\OneToOne(targetEntity: User::class, orphanRemoval: true, cascade: ['persist', 'remove'])]
#[ApiFilter(SearchFilter::class, strategy: 'exact')]
private ?\App\Entity\User $user = null;
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'customer')]
private \Doctrine\Common\Collections\Collection|array $comments;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $gender = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'date', nullable: true)]
private ?\DateTimeInterface $dateOfBirth = null;
#[ORM\OneToMany(targetEntity: CustomerAddress::class, mappedBy: 'customer', cascade: ['persist', 'remove'])]
private \Doctrine\Common\Collections\Collection|array $customerAddresses;
#[ORM\OneToMany(targetEntity: CustomerWalletPoint::class, mappedBy: 'customer', orphanRemoval: true, cascade: ['persist', 'remove'])]
private \Doctrine\Common\Collections\Collection|array $customerWalletPoints;
#[ORM\ManyToOne(targetEntity: Vendor::class, inversedBy: 'customers')]
private ?\App\Flexy\ShopBundle\Entity\Vendor\Vendor $vendor = null;
#[ORM\ManyToOne(targetEntity: CityRegion::class)]
#[Groups(["read","write"])]
private $cityRegion;
#[ORM\OneToMany(targetEntity: PackEngagement::class, mappedBy: 'customer', cascade: ['remove'], orphanRemoval: true)]
private \Doctrine\Common\Collections\Collection|array $packEngagements;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $sponsorshipCode = null;
#[Groups(["read","write"])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $image = null;
#[ORM\ManyToMany(targetEntity: Coupon::class, mappedBy: 'allowedCustomers')]
private \Doctrine\Common\Collections\Collection|array $affectedCoupons;
#[ORM\OneToMany(targetEntity: Coupon::class, mappedBy: 'onlyThisCustomer')]
private \Doctrine\Common\Collections\Collection|array $affectedCouponsOnlyForMe;
#[Groups(["read","write"])]
#[ORM\Column(type: 'boolean', nullable: true)]
private $canReceiveMails;
#[Groups(["read","write"])]
#[ORM\Column(type: 'boolean', nullable: true)]
private $canReceiveSms;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $blindPassword;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $deletedAt = null;
#[ORM\OneToMany(mappedBy: 'senderCustomer', targetEntity: Shipment::class)]
private Collection $sentShipments;
#[ORM\OneToMany(mappedBy: 'recipientCustomer', targetEntity: Shipment::class)]
private Collection $receivedShipments;
#[ORM\OneToMany(mappedBy: 'customer', targetEntity: BankBookItem::class)]
private Collection $bankBookItems;
#[ORM\OneToMany(mappedBy: 'customer', targetEntity: CashOnDelivery::class)]
private Collection $cashOnDeliveries;
#[ORM\OneToMany(mappedBy: 'customer', targetEntity: ProductSubscription::class)]
#[Groups(["read","write"])]
private Collection $productSubscriptions;
#[Groups(["read","write"])]
#[ORM\ManyToOne(inversedBy: 'customers')]
private ?Store $store = null;
// Undefined array key \"invoice\"" To be fixed for #[Groups(['read','write'])]
#[ORM\OneToMany(mappedBy: 'customer', targetEntity: Invoice::class)]
private Collection $invoices;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["read","write"])]
private ?string $collectAddress = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["read","write"])]
private ?string $shippingAddress = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["read","write"])]
private ?string $collectLat = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["read","write"])]
private ?string $collectLng = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["read","write"])]
private ?string $shippingLng = null;
#[ORM\OneToMany(mappedBy: 'customer', targetEntity: Complaint::class)]
#[Groups(["read","write"])]
private Collection $complaints;
#[ORM\Column(nullable: true)]
private ?array $metaData = null;
public function __construct()
{
$this->sentShipments = new ArrayCollection();
$this->receivedShipments = new ArrayCollection();
$this->bankBookItems = new ArrayCollection();
$this->cashOnDeliveries = new ArrayCollection();
$this->productSubscriptions = new ArrayCollection();
$this->invoices = new ArrayCollection();
$this->customerWalletPoints = new ArrayCollection();
$this->createdAt = new \DateTime();
$this->complaints = new ArrayCollection();
}
public function __toString(): string
{
return $this->firstName." ".$this->lastName;
}
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
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 getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}
public function getAddressIndication(): ?string
{
return $this->addressIndication;
}
public function setAddressIndication(?string $addressIndication): self
{
$this->addressIndication = $addressIndication;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
public function getPostCode(): ?string
{
return $this->postCode;
}
public function setPostCode(string $postCode): self
{
$this->postCode = $postCode;
return $this;
}
/**
* @return Collection|Order[]
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setCustomer($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->getCustomer() === $this) {
$order->setCustomer(null);
}
}
return $this;
}
public function getCustomerGroup(): ?CustomerGroup
{
return $this->customerGroup;
}
public function setCustomerGroup(?CustomerGroup $customerGroup): self
{
$this->customerGroup = $customerGroup;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection|Comment[]
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments[] = $comment;
$comment->setCustomer($this);
}
return $this;
}
public function removeComment(Comment $comment): self
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getCustomer() === $this) {
$comment->setCustomer(null);
}
}
return $this;
}
public function getGender(): ?string
{
return $this->gender;
}
public function setGender(?string $gender): self
{
$this->gender = $gender;
return $this;
}
public function getDateOfBirth(): ?\DateTimeInterface
{
return $this->dateOfBirth;
}
public function setDateOfBirth(?\DateTimeInterface $dateOfBirth): self
{
$this->dateOfBirth = $dateOfBirth;
return $this;
}
/**
* @return Collection<int, CustomerAddress>
*/
public function getCustomerAddresses(): Collection
{
return $this->customerAddresses;
}
public function addCustomerAddress(CustomerAddress $customerAddress): self
{
if (!$this->customerAddresses->contains($customerAddress)) {
$this->customerAddresses[] = $customerAddress;
$customerAddress->setCustomer($this);
}
return $this;
}
public function removeCustomerAddress(CustomerAddress $customerAddress): self
{
if ($this->customerAddresses->removeElement($customerAddress)) {
// set the owning side to null (unless already changed)
if ($customerAddress->getCustomer() === $this) {
$customerAddress->setCustomer(null);
}
}
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->setCustomer($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->getCustomer() === $this) {
$customerWalletPoint->setCustomer(null);
}
}
return $this;
}
#[Groups(["read","write"])]
public function getCredit(){
$credit = 0;
foreach($this->getCustomerWalletPoints() as $singleWalletPoint){
if($singleWalletPoint->getOriginInvoice()){
if($singleWalletPoint->getOriginInvoice()->getStatus() != "draft"){
$credit = $credit + $singleWalletPoint->getPoints();
}
}
}
return $credit;
}
#[Groups(["read","write"])]
public function getWalletCredit(){
$credit = 0;
foreach($this->getCustomerWalletPoints() as $singleWalletPoint){
$credit = $credit + $singleWalletPoint->getPoints();
}
return $credit;
}
public function getVendor(): ?Vendor
{
return $this->vendor;
}
public function setVendor(?Vendor $vendor): self
{
$this->vendor = $vendor;
return $this;
}
/**
* @return Collection<int, PackEngagement>
*/
public function getPackEngagements(): Collection
{
return $this->packEngagements;
}
public function addPackEngagement(PackEngagement $packEngagement): self
{
if (!$this->packEngagements->contains($packEngagement)) {
$this->packEngagements[] = $packEngagement;
$packEngagement->setCustomer($this);
}
return $this;
}
public function removePackEngagement(PackEngagement $packEngagement): self
{
if ($this->packEngagements->removeElement($packEngagement)) {
// set the owning side to null (unless already changed)
if ($packEngagement->getCustomer() === $this) {
$packEngagement->setCustomer(null);
}
}
return $this;
}
public function getSponsorshipCode(): ?string
{
return $this->sponsorshipCode;
}
public function setSponsorshipCode(?string $sponsorshipCode): self
{
$this->sponsorshipCode = $sponsorshipCode;
return $this;
}
public function getMySponsorshipCode(){
return "PRN0000".$this->getId();
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
/**
* @return Collection<int, Coupon>
*/
public function getAffectedCoupons(): Collection
{
return $this->affectedCoupons;
}
public function addAffectedCoupon(Coupon $affectedCoupon): self
{
if (!$this->affectedCoupons->contains($affectedCoupon)) {
$this->affectedCoupons[] = $affectedCoupon;
$affectedCoupon->addAllowedCustomer($this);
}
return $this;
}
public function removeAffectedCoupon(Coupon $affectedCoupon): self
{
if ($this->affectedCoupons->removeElement($affectedCoupon)) {
$affectedCoupon->removeAllowedCustomer($this);
}
return $this;
}
/**
* @return Collection<int, Coupon>
*/
public function getAffectedCouponsOnlyForMe(): Collection
{
return $this->affectedCouponsOnlyForMe;
}
public function addAffectedCouponsOnlyForMe(Coupon $affectedCouponsOnlyForMe): self
{
if (!$this->affectedCouponsOnlyForMe->contains($affectedCouponsOnlyForMe)) {
$this->affectedCouponsOnlyForMe[] = $affectedCouponsOnlyForMe;
$affectedCouponsOnlyForMe->setOnlyThisCustomer($this);
}
return $this;
}
public function removeAffectedCouponsOnlyForMe(Coupon $affectedCouponsOnlyForMe): self
{
if ($this->affectedCouponsOnlyForMe->removeElement($affectedCouponsOnlyForMe)) {
// set the owning side to null (unless already changed)
if ($affectedCouponsOnlyForMe->getOnlyThisCustomer() === $this) {
$affectedCouponsOnlyForMe->setOnlyThisCustomer(null);
}
}
return $this;
}
/**
* Get the value of canReceiveMails
*/
public function getCanReceiveMails()
{
return $this->canReceiveMails;
}
/**
* Set the value of canReceiveMails
*
* @return self
*/
public function setCanReceiveMails($canReceiveMails)
{
$this->canReceiveMails = $canReceiveMails;
return $this;
}
/**
* Get the value of canReceiveSms
*/
public function getCanReceiveSms()
{
return $this->canReceiveSms;
}
/**
* Set the value of canReceiveSms
*
* @return self
*/
public function setCanReceiveSms($canReceiveSms)
{
$this->canReceiveSms = $canReceiveSms;
return $this;
}
/**
* Get the value of blindPassword
*/
public function getBlindPassword()
{
return $this->blindPassword;
}
/**
* Set the value of blindPassword
*
* @return self
*/
public function setBlindPassword($blindPassword)
{
$this->blindPassword = $blindPassword;
return $this;
}
/**
* Get the value of city
*/
public function getCity()
{
return $this->city;
}
/**
* Set the value of city
*
* @return self
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get the value of cityRegion
*/
public function getCityRegion()
{
return $this->cityRegion;
}
/**
* Set the value of cityRegion
*
* @return self
*/
public function setCityRegion($cityRegion)
{
$this->cityRegion = $cityRegion;
return $this;
}
public function getDeletedAt(): ?\DateTimeImmutable
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeImmutable $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* @return Collection<int, Shipment>
*/
public function getSentShipments(): Collection
{
return $this->sentShipments;
}
public function addSentShipment(Shipment $sentShipment): self
{
if (!$this->sentShipments->contains($sentShipment)) {
$this->sentShipments->add($sentShipment);
$sentShipment->setSenderCustomer($this);
}
return $this;
}
public function removeSentShipment(Shipment $sentShipment): self
{
if ($this->sentShipments->removeElement($sentShipment)) {
// set the owning side to null (unless already changed)
if ($sentShipment->getSenderCustomer() === $this) {
$sentShipment->setSenderCustomer(null);
}
}
return $this;
}
/**
* @return Collection<int, Shipment>
*/
public function getReceivedShipments(): Collection
{
return $this->receivedShipments;
}
public function addReceivedShipment(Shipment $receivedShipment): self
{
if (!$this->receivedShipments->contains($receivedShipment)) {
$this->receivedShipments->add($receivedShipment);
$receivedShipment->setRecipientCustomer($this);
}
return $this;
}
public function removeReceivedShipment(Shipment $receivedShipment): self
{
if ($this->receivedShipments->removeElement($receivedShipment)) {
// set the owning side to null (unless already changed)
if ($receivedShipment->getRecipientCustomer() === $this) {
$receivedShipment->setRecipientCustomer(null);
}
}
return $this;
}
/**
* @return Collection<int, BankBookItem>
*/
public function getBankBookItems(): Collection
{
return $this->bankBookItems;
}
public function addBankBookItem(BankBookItem $bankBookItem): self
{
if (!$this->bankBookItems->contains($bankBookItem)) {
$this->bankBookItems->add($bankBookItem);
$bankBookItem->setCustomer($this);
}
return $this;
}
public function removeBankBookItem(BankBookItem $bankBookItem): self
{
if ($this->bankBookItems->removeElement($bankBookItem)) {
// set the owning side to null (unless already changed)
if ($bankBookItem->getCustomer() === $this) {
$bankBookItem->setCustomer(null);
}
}
return $this;
}
/**
* @return Collection<int, CashOnDelivery>
*/
public function getCashOnDeliveries(): Collection
{
return $this->cashOnDeliveries;
}
public function addCashOnDelivery(CashOnDelivery $cashOnDelivery): self
{
if (!$this->cashOnDeliveries->contains($cashOnDelivery)) {
$this->cashOnDeliveries->add($cashOnDelivery);
$cashOnDelivery->setCustomer($this);
}
return $this;
}
public function removeCashOnDelivery(CashOnDelivery $cashOnDelivery): self
{
if ($this->cashOnDeliveries->removeElement($cashOnDelivery)) {
// set the owning side to null (unless already changed)
if ($cashOnDelivery->getCustomer() === $this) {
$cashOnDelivery->setCustomer(null);
}
}
return $this;
}
/**
* @return Collection<int, ProductSubscription>
*/
public function getProductSubscriptions(): Collection
{
return $this->productSubscriptions;
}
public function addProductSubscription(ProductSubscription $productSubscription): self
{
if (!$this->productSubscriptions->contains($productSubscription)) {
$this->productSubscriptions->add($productSubscription);
$productSubscription->setCustomer($this);
}
return $this;
}
public function removeProductSubscription(ProductSubscription $productSubscription): self
{
if ($this->productSubscriptions->removeElement($productSubscription)) {
// set the owning side to null (unless already changed)
if ($productSubscription->getCustomer() === $this) {
$productSubscription->setCustomer(null);
}
}
return $this;
}
public function getStore(): ?Store
{
return $this->store;
}
public function setStore(?Store $store): self
{
$this->store = $store;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices->add($invoice);
$invoice->setCustomer($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getCustomer() === $this) {
$invoice->setCustomer(null);
}
}
return $this;
}
public function getCollectAddress(): ?string
{
if(!$this->collectAddress){
return $this->getAddress();
}
return $this->collectAddress;
}
public function setCollectAddress(?string $collectAddress): self
{
$this->collectAddress = $collectAddress;
return $this;
}
public function getShippingAddress(): ?string
{
if(!$this->shippingAddress){
return $this->getAddress();
}
return $this->shippingAddress;
}
public function setShippingAddress(?string $shippingAddress): self
{
$this->shippingAddress = $shippingAddress;
return $this;
}
public function getCollectLat(): ?string
{
return $this->collectLat;
}
public function setCollectLat(?string $collectLat): self
{
$this->collectLat = $collectLat;
return $this;
}
public function getCollectLng(): ?string
{
return $this->collectLng;
}
public function setCollectLng(string $collectLng): self
{
$this->collectLng = $collectLng;
return $this;
}
public function getShippingLng(): ?string
{
return $this->shippingLng;
}
public function setShippingLng(?string $shippingLng): self
{
$this->shippingLng = $shippingLng;
return $this;
}
/**
* @return Collection<int, Complaint>
*/
public function getComplaints(): Collection
{
return $this->complaints;
}
public function addComplaint(Complaint $complaint): self
{
if (!$this->complaints->contains($complaint)) {
$this->complaints->add($complaint);
$complaint->setCustomer($this);
}
return $this;
}
public function removeComplaint(Complaint $complaint): self
{
if ($this->complaints->removeElement($complaint)) {
// set the owning side to null (unless already changed)
if ($complaint->getCustomer() === $this) {
$complaint->setCustomer(null);
}
}
return $this;
}
#[Groups(["read"])]
public function getFullName(){
return $this->firstName.' '.$this->lastName;
}
#[Groups(["read"])]
public function getFullNameWithPhone(){
return $this->firstName.' '.$this->lastName.' '.$this->phone;
}
public function getMetaData(): ?array
{
return $this->metaData;
}
public function setMetaData(?array $metaData): static
{
$this->metaData = $metaData;
return $this;
}
public function getTotalOrders(){
return count($this->getOrders());
}
}