src/Entity/Customer.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\CustomerRepository")
  12.  * @Vich\Uploadable
  13.  */
  14. class Customer implements UserInterface
  15. {
  16.   /**
  17.    * Roles customer
  18.    */
  19.   const ROLE_CUSTOMER "ROLE_CUSTOMER";
  20.   const ROLE_ADMIN_CLUB "ROLE_ADMIN_CLUB";
  21.   const ROLE_CUSTOMER_DEPENDENT "ROLE_CUSTOMER_DEPENDENT";
  22.   /** */
  23.   const TYPE_ACCOUNT_APP "APP";
  24.   const TYPE_ACCOUNT_FACEBOOK "FACEBOOK";
  25.   const TYPE_ACCOUNT_GOOGLE "GOOGLE";
  26.   /**
  27.    * @ORM\Id()
  28.    * @ORM\GeneratedValue()
  29.    * @ORM\Column(type="integer")
  30.    */
  31.   private $id;
  32.   /**
  33.    * @ORM\Column(type="string", length=180, unique=true)
  34.    */
  35.   private $email;
  36.   /**
  37.    * @ORM\Column(type="string", length=20, unique=true)
  38.    */
  39.   private $username;
  40.   /**
  41.    * @ORM\Column(type="json")
  42.    */
  43.   private $roles = [];
  44.   /**
  45.    * @var string The hashed password
  46.    * @ORM\Column(type="string")
  47.    */
  48.   private $password;
  49.   /**
  50.    * @ORM\Column(type="string", length=20, nullable=true)
  51.    */
  52.   private $plainPassword;
  53.   /**
  54.    * @ORM\Column(type="boolean")
  55.    */
  56.   private $enabled;
  57.   /**
  58.    * @ORM\Column(type="string")
  59.    */
  60.   private $name;
  61.   /**
  62.    * @ORM\Column(type="string",nullable=true)
  63.    */
  64.   private $surname;
  65.   /**
  66.    * @ORM\Column(type="string", nullable=true)
  67.    */
  68.   private $address;
  69.   /**
  70.    * @ORM\Column(type="string", nullable=true)
  71.    */
  72.   private $celular;
  73.   /**
  74.    * @ORM\Column(type="string", length=255, nullable=true)
  75.    * @var string
  76.    */
  77.   private $image;
  78.   /**
  79.    * @Vich\UploadableField(mapping="customer_images", fileNameProperty="image")
  80.    * @var File
  81.    */
  82.   private $imageFile;
  83.   /**
  84.    * @ORM\Column(type="datetime", nullable=true)
  85.    * @var \DateTime
  86.    */
  87.   private $createdAt;
  88.   /**
  89.    * @ORM\Column(type="datetime", nullable=true)
  90.    * @var \DateTime
  91.    */
  92.   private $updatedAt;
  93.   /**
  94.    * @ORM\OneToMany(targetEntity="App\Entity\Season", mappedBy="customer", cascade={"remove"})
  95.    */
  96.   private $season;
  97.   /**
  98.    * @ORM\ManyToOne(targetEntity="App\Entity\Country", inversedBy="customers")
  99.    */
  100.   private $country;
  101.   /**
  102.    *
  103.    * @ORM\Column(name="country_id", type="integer", nullable=true)
  104.    */
  105.   public $countryId;
  106.   /**
  107.    * @ORM\Column(type="integer", nullable=true)
  108.    */
  109.   public $seasonActive;
  110.   /**
  111.    * @ORM\OneToMany(targetEntity="App\Entity\Suggestion", mappedBy="customer", orphanRemoval=true)
  112.    */
  113.   private $suggestions;
  114.   /**
  115.    * @ORM\Column(type="string", length=255, nullable=true)
  116.    */
  117.   private $typeAccount;
  118.   /**
  119.    * @ORM\Column(type="boolean", nullable=true)
  120.    */
  121.   private $isPro;
  122.   /**
  123.    * @ORM\Column(type="text", nullable=true)
  124.    */
  125.   private $purchase;
  126.    /**
  127.    * @ORM\Column(type="text", nullable=true)
  128.    */
  129.   private $purchasePlatform;
  130.   /**
  131.    * @ORM\Column(type="string", length=255, nullable=true)
  132.    */
  133.   private $membershipId;
  134.   /**
  135.    * @ORM\OneToMany(targetEntity="App\Entity\CouponCustomer", mappedBy="customer", orphanRemoval=true)
  136.    * @ORM\OrderBy({"id" = "ASC"})
  137.    */
  138.   private $customerCoupons;
  139.   /**
  140.    * @ORM\Column(type="boolean", nullable=true)
  141.    */
  142.   private $couponStatus;
  143.   /**
  144.    * @ORM\Column(type="string", length=255, nullable=true)
  145.    */
  146.   private $phone;
  147.   /**
  148.    * @ORM\Column(type="string", length=16, nullable=true)
  149.    */
  150.   private $googleAuthCode;
  151.   /**
  152.    * @ORM\Column(type="boolean", nullable=true)
  153.    */
  154.   private $googleAuthCodeVerified;
  155.   /**
  156.    * @ORM\Column(type="datetime", length=255,nullable=true)
  157.    * @var \DateTime
  158.    */
  159.   private $dateOfBirth;
  160.   /**
  161.    * @ORM\ManyToMany(targetEntity="App\Entity\Notification", mappedBy="customers")
  162.    * @ORM\JoinColumn(nullable=false)
  163.    */
  164.   private $notifications;
  165.   /**
  166.    * @ORM\Column(type="datetime", nullable=true)
  167.    * @var \DateTime
  168.    */
  169.   private $deletedAt;
  170.   /**
  171.    * @ORM\Column(type="integer", nullable=true)
  172.    */
  173.   private $isDeleted;
  174.   /**
  175.    * @ORM\OneToMany(targetEntity=ExerciseQualification::class, mappedBy="customer_id")
  176.    */
  177.   private $exerciseQualifications;
  178.   /**
  179.    * @ORM\OneToMany(targetEntity=Strategy::class, mappedBy="customer", orphanRemoval=true)
  180.    */
  181.   private $strategies;
  182.   /**
  183.    * Customer constructor.
  184.    */
  185.   public function __construct()
  186.   {
  187.     $this->enabled true;
  188.     $this->roles = array();
  189.     $this->season = new ArrayCollection();
  190.     $this->suggestions = new ArrayCollection();
  191.     $this->customerCoupons = new ArrayCollection();
  192.     $this->notifications = new ArrayCollection();
  193.     $this->exerciseQualifications = new ArrayCollection();
  194.     $this->strategies = new ArrayCollection();
  195.   }
  196.   public function getId(): ?int
  197.   {
  198.     return $this->id;
  199.   }
  200.   public function getEmail(): ?string
  201.   {
  202.     if (empty($this->email)) {
  203.       return $this->username;
  204.     }
  205.     return $this->email;
  206.   }
  207.   public function setEmail(string $email): self
  208.   {
  209.     $this->email $email;
  210.     return $this;
  211.   }
  212.   public function getUsername(): ?string
  213.   {
  214.     if (empty($this->username)) {
  215.       return $this->email;
  216.     }
  217.     return $this->username;
  218.   }
  219.   public function setUsername(string $username): self
  220.   {
  221.     $this->username $username;
  222.     return $this;
  223.   }
  224.   /**
  225.    * @see UserInterface
  226.    */
  227.   public function getRoles(): array
  228.   {
  229.     $roles $this->roles;
  230.     // guarantee every user at least has ROLE_USER
  231.     //$roles[] = 'ROLE_USER';
  232.     return array_unique($roles);
  233.   }
  234.   public function setRoles(array $roles): self
  235.   {
  236.     $this->roles $roles;
  237.     return $this;
  238.   }
  239.   public function addRole($role)
  240.   {
  241.     $role strtoupper($role);
  242.     if (!in_array($role$this->rolestrue)) {
  243.       $this->roles[] = $role;
  244.     }
  245.     return $this;
  246.   }
  247.   /**
  248.    * @see UserInterface
  249.    */
  250.   public function getPassword(): string
  251.   {
  252.     return (string)$this->password;
  253.   }
  254.   public function setPassword(string $password): self
  255.   {
  256.     $this->password $password;
  257.     return $this;
  258.   }
  259.   public function getPlainPassword(): ?string
  260.   {
  261.     return $this->plainPassword;
  262.   }
  263.   public function setPlainPassword(string $plainPassword): self
  264.   {
  265.     $this->plainPassword $plainPassword;
  266.     return $this;
  267.   }
  268.   /**
  269.    * @see UserInterface
  270.    */
  271.   public function getSalt()
  272.   {
  273.     // not needed when using the "bcrypt" algorithm in security.yaml
  274.   }
  275.   /**
  276.    * @see UserInterface
  277.    */
  278.   public function eraseCredentials()
  279.   {
  280.     // If you store any temporary, sensitive data on the user, clear it here
  281.     $this->plainPassword null;
  282.   }
  283.   /**
  284.    * @return mixed
  285.    */
  286.   public function getEnabled()
  287.   {
  288.     return $this->enabled;
  289.   }
  290.   /**
  291.    * @param mixed $enabled
  292.    * @return Customer
  293.    */
  294.   public function setEnabled($enabled)
  295.   {
  296.     $this->enabled $enabled;
  297.     return $this;
  298.   }
  299.   /**
  300.    * @return mixed
  301.    */
  302.   public function getName()
  303.   {
  304.     return $this->name;
  305.   }
  306.   /**
  307.    * @param mixed $name
  308.    * @return Customer
  309.    */
  310.   public function setName(string $name)
  311.   {
  312.     $this->name $name;
  313.     return $this;
  314.   }
  315.   /**
  316.    * @return mixed
  317.    */
  318.   public function getSurname()
  319.   {
  320.     return $this->surname;
  321.   }
  322.   /**
  323.    * @param mixed $surname
  324.    * @return Customer
  325.    */
  326.   public function setSurname($surname)
  327.   {
  328.     $this->surname $surname;
  329.     return $this;
  330.   }
  331.   /**
  332.    * @return mixed
  333.    */
  334.   public function getAddress()
  335.   {
  336.     return $this->address;
  337.   }
  338.   /**
  339.    * @param mixed $address
  340.    * @return Customer
  341.    */
  342.   public function setAddress($address)
  343.   {
  344.     $this->address $address;
  345.     return $this;
  346.   }
  347.   /**
  348.    * @return mixed
  349.    */
  350.   public function getCelular()
  351.   {
  352.     return $this->celular;
  353.   }
  354.   /**
  355.    * @param mixed $celular
  356.    * @return Customer
  357.    */
  358.   public function setCelular($celular)
  359.   {
  360.     $this->celular $celular;
  361.     return $this;
  362.   }
  363.   /**
  364.    * @param File|null $image
  365.    * @return Customer
  366.    */
  367.   public function setImageFile(File $image null)
  368.   {
  369.     $this->imageFile $image;
  370.     // VERY IMPORTANT:
  371.     // It is required that at least one field changes if you are using Doctrine,
  372.     // otherwise the event listeners won't be called and the file is lost
  373.     if ($image) {
  374.       // if 'updatedAt' is not defined in your entity, use another property
  375.       $this->updatedAt = new \DateTime('now');
  376.     }
  377.     return $this;
  378.   }
  379.   public function getImageFile()
  380.   {
  381.     return $this->imageFile;
  382.   }
  383.   /**
  384.    * @param $image
  385.    * @return Customer
  386.    */
  387.   public function setImage($image)
  388.   {
  389.     $this->image $image;
  390.     return $this;
  391.   }
  392.   /**
  393.    * @return string
  394.    */
  395.   public function getImage()
  396.   {
  397.     return $this->image;
  398.   }
  399.   /**
  400.    * @return string
  401.    */
  402.   public function getNameTeam()
  403.   {
  404.     $name "";
  405.     /** @var Season $s */
  406.     $s $this->getSeasonActive();
  407.     if ($s && !empty($s->getTeam()))
  408.       $name $s->getTeam()->getName();
  409.     return $name;
  410.   }
  411.     /**
  412.    * @return ?string
  413.    */
  414.   public function getStadiumName()
  415.   {
  416.     $name null;
  417.     /** @var Season $s */
  418.     $s $this->getSeasonActive();
  419.     if ($s && !empty($s->getTeam()))
  420.       $name $s->getTeam()->getStadiumName();
  421.     return $name;
  422.   }
  423.     /**
  424.    * @return ?string
  425.    */
  426.   public function getEmailClub()
  427.   {
  428.     $name null;
  429.     /** @var Season $s */
  430.     $s $this->getSeasonActive();
  431.     if ($s && !empty($s->getTeam()))
  432.       $name $s->getTeam()->getEmailClub();
  433.     return $name;
  434.   }
  435.   public function getMonthlyCostTeam()
  436.   {
  437.     $name null;
  438.     /** @var Season $s */
  439.     $s $this->getSeasonActive();
  440.     if ($s && !empty($s->getTeam()))
  441.       $name $s->getTeam()->getMonthlyCost();
  442.     return $name;
  443.   }
  444.   public function getKitPaymentCostTeam()
  445.   {
  446.     $name null;
  447.     /** @var Season $s */
  448.     $s $this->getSeasonActive();
  449.     if ($s && !empty($s->getTeam()))
  450.       $name $s->getTeam()->getKitPaymentCost();
  451.     return $name;
  452.   }
  453.   public function getOtherPaymentCostTeam()
  454.   {
  455.     $name null;
  456.     /** @var Season $s */
  457.     $s $this->getSeasonActive();
  458.     if ($s && !empty($s->getTeam()))
  459.       $name $s->getTeam()->getOtherPaymentCost();
  460.     return $name;
  461.   }
  462.   public function setNameTeam($name)
  463.   {
  464.     $this->nameTeam $name;
  465.     return $this;
  466.   }
  467.   public function setCategoryTeam($name)
  468.   {
  469.     $this->categoryTeam $name;
  470.     return $this;
  471.   }
  472.   /**
  473.    * @return string
  474.    */
  475.   public function getCategoryTeam()
  476.   {
  477.     $category "";
  478.     /** @var Season $s */
  479.     $s $this->getSeasonActive();
  480.     if ($s && !empty($s->getTeam()))
  481.       $category $s->getTeam()->getCategory();
  482.     return $category;
  483.   }
  484.   /**
  485.    * @return string
  486.    */
  487.   public function getTypeSoccerTeamId()
  488.   {
  489.     $typeSoccerTeamId "";
  490.     /** @var Season $s */
  491.     $s $this->getSeasonActive();
  492.     if ($s && !empty($s->getTeam())) {
  493.       $typeSoccerTeamId $s->getTeam()->getTypeSoccer();
  494.       if ($typeSoccerTeamId) {
  495.         $typeSoccerTeamId $typeSoccerTeamId->getId();
  496.       }
  497.     }
  498.     return $this->typeSoccerTeamId $typeSoccerTeamId;
  499.   }
  500.   /**
  501.    * @return string
  502.    */
  503.   public function getTypeSoccerTeamName()
  504.   {
  505.     $typeSoccerTeamName "";
  506.     /** @var Season $s */
  507.     $s $this->getSeasonActive();
  508.     if ($s && !empty($s->getTeam())) {
  509.       $typeSoccerTeamName $s->getTeam()->getTypeSoccer();
  510.       if ($typeSoccerTeamName) {
  511.         $typeSoccerTeamName $typeSoccerTeamName->getName();
  512.       }
  513.     }
  514.     return $this->typeSoccerTeamName $typeSoccerTeamName;
  515.   }
  516.   public function setTypeSoccerTeamId(int $typeId)
  517.   {
  518.     $this->typeSoccerTeamId $typeId;
  519.     return $this;
  520.   }
  521.   public function getTypeSoccer()
  522.   {
  523.     $typeSoccerName "";
  524.     /** @var Season $s */
  525.     $s $this->getSeasonActive();
  526.     if ($s && !empty($s->getTeam()))
  527.       $typeSoccerName $s->getTeam()->getTypeSoccer();
  528.     return $typeSoccerName;
  529.   }
  530.   /**
  531.    * @return Tactic
  532.    */
  533.   public function getAlignmentDefaultU7()
  534.   {
  535.     $typeSoccerName "";
  536.     /** @var Season $s */
  537.     $s $this->getSeasonActive();
  538.     if ($s && !empty($s->getTeam())) {
  539.       $aligment =  $s->getTeam()->getAlignmentDefaultU7();
  540.       return $aligment;
  541.     }
  542.     return $typeSoccerName;
  543.   }
  544.   /**
  545.    * @return Tactic
  546.    */
  547.   public function getAlignmentDefaultU8()
  548.   {
  549.     $typeSoccerName "";
  550.     /** @var Season $s */
  551.     $s $this->getSeasonActive();
  552.     if ($s && !empty($s->getTeam())) {
  553.       return $s->getTeam()->getAlignmentDefaultU8();
  554.     }
  555.     return $typeSoccerName;
  556.   }
  557.   /**
  558.    * @return Tactic
  559.    */
  560.   public function getAlignmentDefaultU11()
  561.   {
  562.     $typeSoccerName "";
  563.     /** @var Season $s */
  564.     $s $this->getSeasonActive();
  565.     if ($s && !empty($s->getTeam())) {
  566.       return  $s->getTeam()->getAlignmentDefaultU11();
  567.     }
  568.     return $typeSoccerName;
  569.   }
  570.   /**
  571.    * @return string
  572.    */
  573.   public function getImageTeam()
  574.   {
  575.     $img "";
  576.     /** @var Season $s */
  577.     $s $this->getSeasonActive();
  578.     if ($s && !empty($s->getTeam()))
  579.       $img $s->getTeam()->getImage();
  580.     return $img;
  581.   }
  582.   public function getImageTrainerTeam()
  583.   {
  584.     $img "";
  585.     /** @var Season $s */
  586.     $s $this->getSeasonActive();
  587.     if ($s && !empty($s->getTeam()))
  588.       $img $s->getTeam()->getImageTrainer();
  589.     return $img;
  590.   }
  591.   public function getNumberClubesLeague()
  592.   {
  593.     $numberClubesLeague 0;
  594.     /** @var Season $s */
  595.     $season $this->getSeasonActive();
  596.     if ($season && !empty($season->getTeam()))
  597.       $numberClubesLeague $season->getTeam()->getNumberClubesLeague();
  598.     return $numberClubesLeague;
  599.   }
  600.   /**
  601.    * @return \DateTime
  602.    */
  603.   public function getUpdatedAt(): \DateTime
  604.   {
  605.     return $this->updatedAt;
  606.   }
  607.   /**
  608.    * @param \DateTime $updatedAt
  609.    * @return Customer
  610.    */
  611.   public function setUpdatedAt(\DateTime $updatedAt): Customer
  612.   {
  613.     $this->updatedAt $updatedAt;
  614.     return $this;
  615.   }
  616.   /**
  617.    * @return \DateTime
  618.    */
  619.   public function getCreatedAt()
  620.   {
  621.     return $this->createdAt;
  622.   }
  623.   /**
  624.    * @param \DateTime $createdAt
  625.    * @return Customer
  626.    */
  627.   public function setCreatedAt(\DateTime $createdAt): Customer
  628.   {
  629.     $this->createdAt $createdAt;
  630.     return $this;
  631.   }
  632.   /**
  633.    * @return Collection|Season[]
  634.    */
  635.   public function getSeason(): Collection
  636.   {
  637.     return $this->season;
  638.   }
  639.   public function addSeason(Season $season): self
  640.   {
  641.     if (!$this->season->contains($season)) {
  642.       $this->season[] = $season;
  643.       $season->setCustomer($this);
  644.     }
  645.     return $this;
  646.   }
  647.   public function removeSeason(Season $season): self
  648.   {
  649.     if ($this->season->contains($season)) {
  650.       $this->season->removeElement($season);
  651.       // set the owning side to null (unless already changed)
  652.       if ($season->getCustomer() === $this) {
  653.         $season->setCustomer(null);
  654.       }
  655.     }
  656.     return $this;
  657.   }
  658.   public function getCountry(): ?Country
  659.   {
  660.     return $this->country;
  661.   }
  662.   public function setCountry(?Country $country): self
  663.   {
  664.     $this->country $country;
  665.     return $this;
  666.   }
  667.   public function getCountryId(): ?int
  668.   {
  669.     return $this->countryId;
  670.   }
  671.   public function getSeasonYear(): ?int
  672.   {
  673.     $s $this->getSeasonActive();
  674.     return $s $s->getYear() : null;
  675.   }
  676.   public function setSeasonYear($name)
  677.   {
  678.     $this->yearSeason $name;
  679.     return $this;
  680.   }
  681.   public function setCountryId(?int $countryId): self
  682.   {
  683.     $this->countryId $countryId;
  684.     return $this;
  685.   }
  686.   /**
  687.    * @return Season
  688.    */
  689.   public function getSeasonActive()
  690.   {
  691.     if (!empty($this->seasonActive)) {
  692.       /** @var Season $season */
  693.       foreach ($this->getSeason() as $season) {
  694.         if ($this->seasonActive == $season->getId()) {
  695.           return $season;
  696.         }
  697.       }
  698.     } else {
  699.       if (!empty($this->getSeason())) {
  700.         return $this->getSeason()->last();
  701.       }
  702.     }
  703.     return null;
  704.   }
  705.   public function setSeasonActive(?Season $seasonActive): self
  706.   {
  707.     $this->seasonActive $seasonActive->getId();
  708.     return $this;
  709.   }
  710.   /**
  711.    * @return Season|string
  712.    */
  713.   public function getSeasonActiveText()
  714.   {
  715.     $s $this->getSeasonActive();
  716.     return $s $s->getYear() . " / " . ($s->getYear() + 1) : "";
  717.   }
  718.   /**
  719.    * @return Collection|Suggestion[]
  720.    */
  721.   public function getSuggestions(): Collection
  722.   {
  723.     return $this->suggestions;
  724.   }
  725.   public function addSuggestion(Suggestion $suggestion): self
  726.   {
  727.     if (!$this->suggestions->contains($suggestion)) {
  728.       $this->suggestions[] = $suggestion;
  729.       $suggestion->setCustomer($this);
  730.     }
  731.     return $this;
  732.   }
  733.   public function removeSuggestion(Suggestion $suggestion): self
  734.   {
  735.     if ($this->suggestions->contains($suggestion)) {
  736.       $this->suggestions->removeElement($suggestion);
  737.       // set the owning side to null (unless already changed)
  738.       if ($suggestion->getCustomer() === $this) {
  739.         $suggestion->setCustomer(null);
  740.       }
  741.     }
  742.     return $this;
  743.   }
  744.   /**
  745.    * @return mixed
  746.    */
  747.   public function __toString()
  748.   {
  749.     return self::getEmail();
  750.   }
  751.   public function getTypeAccount(): ?string
  752.   {
  753.     return $this->typeAccount;
  754.   }
  755.   public function setTypeAccount(?string $typeAccount): self
  756.   {
  757.     $this->typeAccount $typeAccount;
  758.     return $this;
  759.   }
  760.   public function getIsPro(): ?bool
  761.   {
  762.     return $this->isPro;
  763.   }
  764.   public function setIsPro(?bool $isPro): self
  765.   {
  766.     $this->isPro $isPro;
  767.     return $this;
  768.   }
  769.   public function getPurchase(): ?string
  770.   {
  771.     return $this->purchase;
  772.   }
  773.   public function setPurchase(?string $purchase): self
  774.   {
  775.     $this->purchase $purchase;
  776.     return $this;
  777.   }
  778.   public function getPurchasePlatform(): ?string
  779.   {
  780.     return $this->purchasePlatform;
  781.   }
  782.   public function setPurchasePlatform(?string $platformPurchase): self
  783.   {
  784.     $this->purchasePlatform $platformPurchase;
  785.     return $this;
  786.   }
  787.   public function getMembershipId(): ?string
  788.   {
  789.     return $this->membershipId;
  790.   }
  791.   public function setMembershipId(?string $membershipId): self
  792.   {
  793.     $this->membershipId $membershipId;
  794.     return $this;
  795.   }
  796.   public function getDateOfBirth(): ?DateTime
  797.   {
  798.     return $this->dateOfBirth;
  799.   }
  800.   public function setDateOfBirth(?DateTime $dateOfBirth): self
  801.   {
  802.     $this->dateOfBirth $dateOfBirth;
  803.     return $this;
  804.   }
  805.   public function getPhone(): ?string
  806.   {
  807.     return $this->phone;
  808.   }
  809.   public function setPhone(?string $phone): self
  810.   {
  811.     $this->phone $phone;
  812.     return $this;
  813.   }
  814.   public function getGoogleAuthCode(): ?string
  815.   {
  816.     return $this->googleAuthCode;
  817.   }
  818.   public function setGoogleAuthCode(?string $googleAuthCode): self
  819.   {
  820.     $this->googleAuthCode $googleAuthCode;
  821.     return $this;
  822.   }
  823.   public function getGoogleAuthCodeVerified(): ?string
  824.   {
  825.     return $this->googleAuthCodeVerified;
  826.   }
  827.   public function setGoogleAuthCodeVerified(?string $googleAuthCodeVerified): self
  828.   {
  829.     $this->googleAuthCodeVerified $googleAuthCodeVerified;
  830.     return $this;
  831.   }
  832.   /**
  833.    * @return Collection|CouponCustomer[]
  834.    */
  835.   public function getCustomerCoupons(): Collection
  836.   {
  837.     return $this->customerCoupons;
  838.   }
  839.   public function getCouponStatus(): ?bool
  840.   {
  841.     /**
  842.      * Get last coupon used, notice relation is ordered by id asc
  843.      */
  844.     $lastCouponCustomer $this->getCustomerCoupons()->last();
  845.     if (!empty($lastCouponCustomer)) {
  846.       /**
  847.        * Valida la fecha de expiracion del cupon de membresia premium
  848.        */
  849.       $now = new \DateTime('now');
  850.       $expiredAtCoupon $lastCouponCustomer->getCoupon()->getExpiresAt();
  851.       return $now <= $expiredAtCoupon;
  852.     }
  853.     return false;
  854.   }
  855.   // public function setCouponStatus(?bool $couponStatus): self
  856.   // {
  857.   //     $this->couponStatus = $couponStatus;
  858.   //     return $this;
  859.   // }
  860.   public function __call($method$arguments)
  861.   {
  862.     $method = ('get' === substr($method03) || 'set' === substr($method03)) ? $method 'get' ucfirst($method);
  863.     return $this->proxyCurrentLocaleTranslation($method$arguments);
  864.   }
  865.   /**
  866.    * @return Collection|Notification[]
  867.    */
  868.   public function getNotifications(): Collection
  869.   {
  870.     return $this->notifications;
  871.   }
  872.   public function addNotification(Notification $notification): self
  873.   {
  874.     if (!$this->notifications->contains($notification)) {
  875.       $this->notifications[] = $notification;
  876.       $notification->setCustomer($this);
  877.     }
  878.     return $this;
  879.   }
  880.   public function removeNotification(Notification $notification): self
  881.   {
  882.     if ($this->notifications->contains($notification)) {
  883.       $this->notifications->removeElement($notification);
  884.       // set the owning side to null (unless already changed)
  885.       if ($notification->getNotification() === $this) {
  886.         $notification->removeCustomer($this);
  887.       }
  888.     }
  889.     return $this;
  890.   }
  891.   /**
  892.    * @return \DateTime
  893.    */
  894.   public function getDeletedAt()
  895.   {
  896.     return $this->deletedAt;
  897.   }
  898.   /**
  899.    * @param \DateTime $createdAt
  900.    * @return Customer
  901.    */
  902.   public function setDeletedAt(?\DateTime $deletedAt): Customer
  903.   {
  904.     $this->deletedAt $deletedAt;
  905.     return $this;
  906.   }
  907.   public function getIsDeleted(): ?int
  908.   {
  909.     return $this->isDeleted;
  910.   }
  911.   public function setIsDeleted(?int $isDeleted): self
  912.   {
  913.     $this->isDeleted $isDeleted;
  914.     return $this;
  915.   }
  916.   /**
  917.    * @return Collection|ExerciseQualification[]
  918.    */
  919.   public function getExerciseQualifications(): Collection
  920.   {
  921.     return $this->exerciseQualifications;
  922.   }
  923.   public function addExerciseQualification(ExerciseQualification $exerciseQualification): self
  924.   {
  925.     if (!$this->exerciseQualifications->contains($exerciseQualification)) {
  926.       $this->exerciseQualifications[] = $exerciseQualification;
  927.       $exerciseQualification->setCustomerId($this);
  928.     }
  929.     return $this;
  930.   }
  931.   public function removeExerciseQualification(ExerciseQualification $exerciseQualification): self
  932.   {
  933.     if ($this->exerciseQualifications->contains($exerciseQualification)) {
  934.       $this->exerciseQualifications->removeElement($exerciseQualification);
  935.       // set the owning side to null (unless already changed)
  936.       if ($exerciseQualification->getCustomerId() === $this) {
  937.         $exerciseQualification->setCustomerId(null);
  938.       }
  939.     }
  940.     return $this;
  941.   }
  942.   public function CountryName()
  943.   {
  944.     return  $this->getCountry() ? $this->getCountry()->getName() : null;
  945.   }
  946.   public function __toArray()
  947.   {
  948.     $result = [
  949.       'id' => $this->getId(),
  950.       'name' => $this->getName(),
  951.       'surname' => $this->getSurname(),
  952.       'email' => $this->getEmail(),
  953.       'phone' => $this->getPhone(),
  954.       'address' => $this->getAddress(),
  955.       'city' => $this->getCity(),
  956.       'zip' => $this->getZip(),
  957.       'country' => $this->getCountry() ? $this->getCountry()->getName() : "",
  958.       "phone" => $this->getPhone(),
  959.       "dateOfBirth" => $this->getDateOfBirth() ?  $this->getDateOfBirth()->format('Y-m-d') : null,
  960.     ];
  961.     return $result;
  962.   }
  963.   /**
  964.    * @return Collection<int, Strategy>
  965.    */
  966.   public function getStrategies(): Collection
  967.   {
  968.       return $this->strategies;
  969.   }
  970.   public function addStrategy(Strategy $strategy): self
  971.   {
  972.       if (!$this->strategies->contains($strategy)) {
  973.           $this->strategies[] = $strategy;
  974.           $strategy->setCustomer($this);
  975.       }
  976.       return $this;
  977.   }
  978.   public function removeStrategy(Strategy $strategy): self
  979.   {
  980.       if ($this->strategies->removeElement($strategy)) {
  981.           // set the owning side to null (unless already changed)
  982.           if ($strategy->getCustomer() === $this) {
  983.               $strategy->setCustomer(null);
  984.           }
  985.       }
  986.       return $this;
  987.   }
  988. }