src/Entity/User.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Garages\Garage;
  4. use App\Entity\PointsCatalog\CatalogPointMovement;
  5. use App\Enum\UserRolesEnum;
  6. use App\Repository\UserRepository;
  7. use DateTime;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  13. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  14. use Symfony\Component\Security\Core\User\UserInterface;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. use Symfony\Component\Validator\Constraints\Email;
  17. /**
  18.  * @ORM\Table(name="vulco_user")
  19.  *
  20.  * @ORM\Entity(repositoryClass=UserRepository::class)
  21.  *
  22.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  23.  *
  24.  * https://symfony.com/doc/5.x/reference/constraints/UniqueEntity.html:
  25.  * (no he conseguit que funcioni)
  26.  * @UniqueEntity("email")
  27.  * @UniqueEntity("username")
  28.  */
  29. class User extends AbstractBase implements PasswordAuthenticatedUserInterfaceUserInterface
  30. {
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity="App\Entity\UserGroup", inversedBy="users")
  33.      *
  34.      * @ORM\JoinColumn(name="user_group_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  35.      */
  36.     private ?UserGroup $userGroup null;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity="App\Entity\Garages\Garage", mappedBy="owner")
  39.      */
  40.     private ?Collection $garages;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity="App\Entity\Garages\Garage", inversedBy="employees")
  43.      *
  44.      * @ORM\JoinColumn(name="employee_garage_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  45.      */
  46.     private ?Garage $employeeGarage null;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity="App\Entity\OnlineShop\Supplier", mappedBy="user")
  49.      */
  50.     private ?Collection $suppliers;
  51.     /**
  52.      * @ORM\ManyToMany(targetEntity="App\Entity\Province")
  53.      *
  54.      * @ORM\JoinTable(name="vulco_user_province",
  55.      *     joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
  56.      *     inverseJoinColumns={@ORM\JoinColumn(name="province_id", referencedColumnName="id")}
  57.      * )
  58.      *
  59.      * @ORM\OrderBy({"name": "ASC"})
  60.      */
  61.     private ?Collection $workProvinces;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity="App\Entity\Documents\DocumentDownload", mappedBy="user", orphanRemoval=true)
  64.      */
  65.     private ?Collection $documentDownloads;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity="App\Entity\OnlineShop\SupplierDocumentDownload", mappedBy="user", orphanRemoval=true)
  68.      */
  69.     private ?Collection $supplierDocumentDownloads;
  70.     /**
  71.      * @ORM\OneToMany(targetEntity="App\Entity\Tracking\UserTracking", mappedBy="user", orphanRemoval=true)
  72.      */
  73.     private ?Collection $userTrackings;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity="App\Entity\PointsCatalog\CatalogPointMovement", mappedBy="user", orphanRemoval=true)
  76.      */
  77.     private ?Collection $pointMovements;
  78.     /**
  79.      * @ORM\Column(type="string", length=180, unique=true)
  80.      * @Assert\Email
  81.      */
  82.     private string $email;
  83.     /**
  84.      * @ORM\Column(type="string", length=180, nullable=true)
  85.      *
  86.      * inhereted from legacy vulco FOSUserBundle
  87.      */
  88.     private ?string $emailCanonical null;
  89.     /**
  90.      * @ORM\Column(type="string", length=180, unique=true)
  91.      */
  92.     private string $username;
  93.     /**
  94.      * @ORM\Column(type="string", length=180, nullable=true)
  95.      *
  96.      * inhereted from legacy vulco FOSUserBundle
  97.      */
  98.     private ?string $usernameCanonical null;
  99.     /**
  100.      * @ORM\Column(type="string", length=255, nullable=true)
  101.      */
  102.     private ?string $name;
  103.     /**
  104.      * @ORM\Column(type="string", length=255, nullable=true)
  105.      */
  106.     private ?string $surname;
  107.     /**
  108.      * @ORM\Column(type="string", length=255, nullable=true)
  109.      */
  110.     private ?string $nif;
  111.     /**
  112.      * @ORM\Column(type="string", length=255, nullable=true)
  113.      */
  114.     private ?string $zone;
  115.     /**
  116.      * @ORM\Column(type="array")
  117.      */
  118.     private array $roles = [];
  119.     /**
  120.      * @ORM\Column(type="string")
  121.      */
  122.     private string $password;
  123.     /**
  124.      * @ORM\Column(type="string", nullable=true)
  125.      */
  126.     private ?string $salt null;
  127.     /**
  128.      * @ORM\Column(type="datetime", name="last_login", nullable=true)
  129.      */
  130.     private ?\DateTimeInterface $lastLogin;
  131.     /**
  132.      * @ORM\Column(type="datetime", name="last_old_login", nullable=true)
  133.      */
  134.     private ?\DateTimeInterface $lastOldLogin;
  135.     /**
  136.      * @ORM\Column(type="datetime", name="last_visit_on", nullable=true)
  137.      */
  138.     private ?\DateTimeInterface $lastVisitOn;
  139.     /**
  140.      * @ORM\Column(type="datetime", name="password_requested_at", nullable=true)
  141.      */
  142.     private ?\DateTimeInterface $passwordRequestedAt;
  143.     /**
  144.      * @ORM\Column(type="string", name="internal_description", nullable=true)
  145.      */
  146.     private ?string $internalDescription;
  147.     /**
  148.      * @ORM\Column(type="boolean", name="enabled", nullable=false)
  149.      */
  150.     private bool $enabled true;
  151.     /**
  152.      * @ORM\Column(type="boolean", nullable=true, options={"default": 0})
  153.      */
  154.     private bool $enableStatisticsManagement false;
  155.     /**
  156.      * @ORM\Column(type="boolean", name="readed_confidentiality", nullable=false)
  157.      */
  158.     private bool $readedConfidentiality false;
  159.     /**
  160.      * @ORM\Column(type="datetime", name="readed_confidentiality_at", nullable=true)
  161.      */
  162.     private ?\DateTimeInterface $readedConfidentialityAt;
  163.     /**
  164.      * @ORM\Column(type="string", name="login_token", nullable=true)
  165.      */
  166.     private ?string $token null;
  167.     /**
  168.      * @ORM\Column(type="string", name="confirmation_token", length=180, nullable=true, unique=true)
  169.      */
  170.     private string $confirmationToken;
  171.     public function __construct()
  172.     {
  173.         $this->createdAt = new \DateTime();
  174.         $this->garages = new ArrayCollection();
  175.         $this->suppliers = new ArrayCollection();
  176.         $this->workProvinces = new ArrayCollection();
  177.         $this->documentDownloads = new ArrayCollection();
  178.         $this->supplierDocumentDownloads = new ArrayCollection();
  179.         $this->userTrackings = new ArrayCollection();
  180.         $this->pointMovements = new ArrayCollection();
  181.     }
  182.     public function getUserIdentifier(): string
  183.     {
  184.         return $this->getUsername();
  185.     }
  186.     public function getUserGroup(): ?UserGroup
  187.     {
  188.         return $this->userGroup;
  189.     }
  190.     public function setUserGroup(?UserGroup $userGroup): self
  191.     {
  192.         $this->userGroup $userGroup;
  193.         return $this;
  194.     }
  195.     public function getGarages(): ?Collection
  196.     {
  197.         return $this->garages;
  198.     }
  199.     public function setGarages(?Collection $garages): self
  200.     {
  201.         $this->garages $garages;
  202.         return $this;
  203.     }
  204.     public function addGarage(Garage $garage): self
  205.     {
  206.         if (!$this->garages->contains($garage)) {
  207.             $this->garages->add($garage);
  208.         }
  209.         return $this;
  210.     }
  211.     public function getEmployeeGarage(): ?Garage
  212.     {
  213.         return $this->employeeGarage;
  214.     }
  215.     public function setEmployeeGarage(?Garage $employeeGarage): User
  216.     {
  217.         $this->employeeGarage $employeeGarage;
  218.         return $this;
  219.     }
  220.     public function getSuppliers(): ?Collection
  221.     {
  222.         return $this->suppliers;
  223.     }
  224.     public function setSuppliers($suppliers): self
  225.     {
  226.         $this->suppliers $suppliers;
  227.         return $this;
  228.     }
  229.     public function getWorkProvinces(): ?Collection
  230.     {
  231.         return $this->workProvinces;
  232.     }
  233.     public function setWorkProvinces(?Collection $workProvinces): self
  234.     {
  235.         $this->workProvinces $workProvinces;
  236.         return $this;
  237.     }
  238.     public function getDocumentDownloads(): ?Collection
  239.     {
  240.         return $this->documentDownloads;
  241.     }
  242.     public function setDocumentDownloads(?Collection $documentDownloads): self
  243.     {
  244.         $this->documentDownloads $documentDownloads;
  245.         return $this;
  246.     }
  247.     public function getSupplierDocumentDownloads(): ?Collection
  248.     {
  249.         return $this->supplierDocumentDownloads;
  250.     }
  251.     public function setSupplierDocumentDownloads(?Collection $supplierDocumentDownloads): self
  252.     {
  253.         $this->supplierDocumentDownloads $supplierDocumentDownloads;
  254.         return $this;
  255.     }
  256.     public function getUserTrackings(): ?Collection
  257.     {
  258.         return $this->userTrackings;
  259.     }
  260.     public function setUserTrackings(?Collection $userTrackings): self
  261.     {
  262.         $this->userTrackings $userTrackings;
  263.         return $this;
  264.     }
  265.     public function getPointMovements(): ?Collection
  266.     {
  267.         return $this->pointMovements;
  268.     }
  269.     public function setPointMovements(?Collection $pointMovements): self
  270.     {
  271.         $this->pointMovements $pointMovements;
  272.         return $this;
  273.     }
  274.     public function getUsername(): string
  275.     {
  276.         return $this->username;
  277.     }
  278.     public function setUsername(string $username): self
  279.     {
  280.         $this->username $username;
  281.         return $this;
  282.     }
  283.     public function getRoles(): array
  284.     {
  285.         $roles $this->roles;
  286.         $roles[] = UserRolesEnum::ROLE_USER_LONG// guarantee every user at least has ROLE_USER
  287.         return array_unique($roles);
  288.     }
  289.     public function setRoles(array $roles): self
  290.     {
  291.         $this->roles $roles;
  292.         return $this;
  293.     }
  294.     public function hasRole(string $role): bool
  295.     {
  296.         return in_array(strtoupper($role), $this->rolestrue);
  297.     }
  298.     public function addRole(string $role): self
  299.     {
  300.         if (!$this->hasRole($role)) {
  301.             $this->roles[] = strtoupper($role);
  302.         }
  303.         return $this;
  304.     }
  305.     public function removeRole(string $role): self
  306.     {
  307.         if (false !== $key array_search(strtoupper($role), $this->rolestrue)) {
  308.             unset($this->roles[$key]);
  309.             $this->roles array_values($this->roles);
  310.         }
  311.         return $this;
  312.     }
  313.     public function getUserRole()
  314.     {
  315.         $role '';
  316.         if ($this->hasRole(UserRolesEnum::ROLE_ADMIN_LONG) || $this->hasRole(UserRolesEnum::ROLE_SUPER_ADMIN_LONG)) {
  317.             $role UserRolesEnum::ROLE_ADMIN;
  318.         } elseif ($this->hasRole(UserRolesEnum::ROLE_MANAGER_LONG)) {
  319.             $role UserRolesEnum::ROLE_MANAGER;
  320.         } elseif ($this->hasRole(UserRolesEnum::ROLE_ASSOCIATED_LONG)) {
  321.             $role UserRolesEnum::ROLE_ASSOCIATED;
  322.         } elseif ($this->hasRole(UserRolesEnum::ROLE_ASSOCIATED_MANAGER_LONG)) {
  323.             $role UserRolesEnum::ROLE_ASSOCIATED_MANAGER;
  324.         } elseif ($this->hasRole(UserRolesEnum::ROLE_COORDINATOR_LONG)) {
  325.             $role UserRolesEnum::ROLE_COORDINATOR;
  326.         } elseif ($this->hasRole(UserRolesEnum::ROLE_PROVIDER_LONG)) {
  327.             $role UserRolesEnum::ROLE_PROVIDER;
  328.         } elseif ($this->hasRole(UserRolesEnum::ROLE_QUALITY_ADVISOR_LONG)) {
  329.             $role UserRolesEnum::ROLE_QUALITY_ADVISOR;
  330.         }
  331.         return $role;
  332.     }
  333.     public function getPassword(): string
  334.     {
  335.         return $this->password;
  336.     }
  337.     public function setPassword(string $password): self
  338.     {
  339.         $this->password $password;
  340.         return $this;
  341.     }
  342.     public function getToken(): ?string
  343.     {
  344.         return $this->token;
  345.     }
  346.     public function setToken(string $token): self
  347.     {
  348.         $this->token $token;
  349.         return $this;
  350.     }
  351.     public function getSalt(): ?string
  352.     {
  353.         return $this->salt;
  354.     }
  355.     public function setSalt(?string $salt): self
  356.     {
  357.         $this->salt $salt;
  358.         return $this;
  359.     }
  360.     public function eraseCredentials(): void
  361.     {
  362.         // If you store any temporary, sensitive data on the user, clear it here
  363.         // $this->plainPassword = null;
  364.     }
  365.     public function getUsernameCanonical(): ?string
  366.     {
  367.         return $this->usernameCanonical;
  368.     }
  369.     public function setUsernameCanonical(?string $usernameCanonical): self
  370.     {
  371.         $this->usernameCanonical $usernameCanonical;
  372.         return $this;
  373.     }
  374.     public function getEmail(): string
  375.     {
  376.         return $this->email;
  377.     }
  378.     public function setEmail(string $email): self
  379.     {
  380.         $this->email strtolower($email);
  381.         return $this;
  382.     }
  383.     public function getEmailCanonical(): ?string
  384.     {
  385.         return $this->emailCanonical;
  386.     }
  387.     public function setEmailCanonical(?string $emailCanonical): self
  388.     {
  389.         $this->emailCanonical $emailCanonical;
  390.         return $this;
  391.     }
  392.     public function getName(): ?string
  393.     {
  394.         return $this->name;
  395.     }
  396.     public function setName(?string $name): self
  397.     {
  398.         $this->name $name;
  399.         return $this;
  400.     }
  401.     public function getNameOrEmail(): string
  402.     {
  403.         return $this->getName() ?: $this->getEmail();
  404.     }
  405.     public function getNameAndEmailString(): string
  406.     {
  407.         return $this->getName() ? $this->getName().' ('.$this->getEmail().')' $this->getEmail();
  408.     }
  409.     public function getSurname(): ?string
  410.     {
  411.         return $this->surname;
  412.     }
  413.     public function setSurname(?string $surname): self
  414.     {
  415.         $this->surname $surname;
  416.         return $this;
  417.     }
  418.     public function getNif(): ?string
  419.     {
  420.         return $this->nif;
  421.     }
  422.     public function setNif(?string $nif): self
  423.     {
  424.         $this->nif $nif;
  425.         return $this;
  426.     }
  427.     public function getZone(): ?string
  428.     {
  429.         return $this->zone;
  430.     }
  431.     public function setZone(?string $zone): self
  432.     {
  433.         $this->zone $zone;
  434.         return $this;
  435.     }
  436.     public function getLastLogin(): ?\DateTimeInterface
  437.     {
  438.         return $this->lastLogin;
  439.     }
  440.     public function setLastLogin(?\DateTimeInterface $lastLogin): self
  441.     {
  442.         $this->lastLogin $lastLogin;
  443.         return $this;
  444.     }
  445.     public function getLastOldLogin(): ?\DateTimeInterface
  446.     {
  447.         return $this->lastOldLogin;
  448.     }
  449.     public function setLastOldLogin(?\DateTimeInterface $lastOldLogin): self
  450.     {
  451.         $this->lastOldLogin $lastOldLogin;
  452.         return $this;
  453.     }
  454.     public function getLastVisitOn(): ?\DateTimeInterface
  455.     {
  456.         return $this->lastVisitOn;
  457.     }
  458.     public function setLastVisitOn(?\DateTimeInterface $lastVisitOn): self
  459.     {
  460.         $this->lastVisitOn $lastVisitOn;
  461.         return $this;
  462.     }
  463.     public function getPasswordRequestedAt(): ?\DateTimeInterface
  464.     {
  465.         return $this->passwordRequestedAt;
  466.     }
  467.     public function setPasswordRequestedAt(?\DateTimeInterface $passwordRequestedAt): self
  468.     {
  469.         $this->passwordRequestedAt $passwordRequestedAt;
  470.         return $this;
  471.     }
  472.     public function getInternalDescription(): ?string
  473.     {
  474.         return $this->internalDescription;
  475.     }
  476.     public function setInternalDescription(?string $internalDescription): self
  477.     {
  478.         $this->internalDescription $internalDescription;
  479.         return $this;
  480.     }
  481.     public function isEnabled(): bool
  482.     {
  483.         return $this->enabled;
  484.     }
  485.     public function getEnabled(): bool
  486.     {
  487.         return $this->isEnabled();
  488.     }
  489.     public function setEnabled(bool $enabled): self
  490.     {
  491.         $this->enabled $enabled;
  492.         return $this;
  493.     }
  494.     public function isEnableStatisticsManagement(): bool
  495.     {
  496.         return $this->enableStatisticsManagement;
  497.     }
  498.     public function getEnableStatisticsManagement(): bool
  499.     {
  500.         return $this->isEnableStatisticsManagement();
  501.     }
  502.     public function setEnableStatisticsManagement(bool $enableStatisticsManagement): self
  503.     {
  504.         $this->enableStatisticsManagement $enableStatisticsManagement;
  505.         return $this;
  506.     }
  507.     public function isReadedConfidentiality(): bool
  508.     {
  509.         return $this->readedConfidentiality;
  510.     }
  511.     public function setReadedConfidentiality(bool $readedConfidentiality): self
  512.     {
  513.         $this->readedConfidentiality $readedConfidentiality;
  514.         return $this;
  515.     }
  516.     public function getReadedConfidentialityAt(): ?\DateTimeInterface
  517.     {
  518.         return $this->readedConfidentialityAt;
  519.     }
  520.     public function setReadedConfidentialityAt(?\DateTimeInterface $readedConfidentialityAt): self
  521.     {
  522.         $this->readedConfidentialityAt $readedConfidentialityAt;
  523.         return $this;
  524.     }
  525.     public function getConfirmationToken(): string
  526.     {
  527.         return $this->confirmationToken;
  528.     }
  529.     public function setConfirmationToken(string $confirmationToken): self
  530.     {
  531.         $this->confirmationToken $confirmationToken;
  532.         return $this;
  533.     }
  534.     public function belongsToUserGroup($userGroups): bool
  535.     {
  536.         $result false;
  537.         if (null !== $userGroups && null !== $this->getUserGroup()) {
  538.             /** @var UserGroup $userGroup */
  539.             foreach ($userGroups as $userGroup) {
  540.                 if ($userGroup->getId() === $this->getUserGroup()->getId()) {
  541.                     $result true;
  542.                     break;
  543.                 }
  544.             }
  545.         }
  546.         return $result;
  547.     }
  548.     public function belongsToUsers($users): bool
  549.     {
  550.         $result false;
  551.         if (null !== $users) {
  552.             /** @var User $user */
  553.             foreach ($users as $user) {
  554.                 if ($user->getId() === $this->getId()) {
  555.                     $result true;
  556.                     break;
  557.                 }
  558.             }
  559.         }
  560.         return $result;
  561.     }
  562.     public function getCatalogPointsAmount(): float
  563.     {
  564.         $catalogPointsAmount 0.0;
  565.         /** @var CatalogPointMovement $pointMovement */
  566.         foreach ($this->pointMovements as $pointMovement) {
  567.             $catalogPointsAmount += $pointMovement->getPoints();
  568.         }
  569.         return $catalogPointsAmount;
  570.     }
  571.     public function getCatalogPointsAmountUntilDate(DateTime $date): float
  572.     {
  573.         $catalogPointsAmount 0.0;
  574.         $dateStr $date->format('Y-m-d');
  575.         /** @var CatalogPointMovement $pointMovement */
  576.         foreach ($this->pointMovements as $pointMovement) {
  577.             $pointMovementDateStr $pointMovement->getDate()->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  578.             if (strtotime($pointMovementDateStr) <= strtotime($dateStr)) {
  579.                 $catalogPointsAmount += $pointMovement->getPoints();
  580.             }
  581.         }
  582.         return $catalogPointsAmount;
  583.     }
  584.     public function getOwnerEarnedPointsWithinCalendarYear(\DateTimeInterface $date): float
  585.     {
  586.         $catalogPointsAmount 0.0;
  587.         $firstDate \DateTimeImmutable::createFromFormat(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT$date->format('Y').'-01-01');
  588.         $lastDate \DateTimeImmutable::createFromFormat(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT$date->format('Y').'-12-31');
  589.         $firstDateYearStr $firstDate->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  590.         $lastDateYearStr $lastDate->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  591.         /** @var CatalogPointMovement $pointMovement */
  592.         foreach ($this->pointMovements as $pointMovement) {
  593.             // if the pointMovement date is within the given calendar year
  594.             $pointMovementDateStr $pointMovement->getDate()->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  595.             // si son puntos positivos (los que gasta son negativos) y no es una devolucion
  596.             if ($pointMovementDateStr >= $firstDateYearStr && $pointMovementDateStr <= $lastDateYearStr && !$pointMovement->isReturnMovement() && ($pointMovement->getPoints() > 0.00001)) {
  597.                 $catalogPointsAmount += $pointMovement->getPoints();
  598.             }
  599.         }
  600.         return $catalogPointsAmount;
  601.     }
  602.     public function getGarageEarnedPointsWithinCalendarYear(Garage $garage\DateTimeInterface $date): float
  603.     {
  604.         $catalogPointsAmount 0.0;
  605.         $firstDate \DateTimeImmutable::createFromFormat(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT$date->format('Y').'-01-01');
  606.         $lastDate \DateTimeImmutable::createFromFormat(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT$date->format('Y').'-12-31');
  607.         $firstDateYearStr $firstDate->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  608.         $lastDateYearStr $lastDate->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  609.         /** @var CatalogPointMovement $pointMovement */
  610.         foreach ($this->pointMovements as $pointMovement) {
  611.             // if the pointMovement belongs to the given garage
  612.             if ($pointMovement->getGarage() && $pointMovement->getGarage()->getId() === $garage->getId()) {
  613.                 // if the pointMovement date is within the given calendar year
  614.                 $pointMovementDateStr $pointMovement->getDate()->format(MiniAbstractBase::DEFAULT_DATE_DATABASE_FORMAT);
  615.                 // si son puntos positivos (los que gasta son negativos) y no es una devolucion
  616.                 if ($pointMovementDateStr >= $firstDateYearStr && $pointMovementDateStr <= $lastDateYearStr && !$pointMovement->isReturnMovement() && ($pointMovement->getPoints() > 0.00001)) {
  617.                     $catalogPointsAmount += $pointMovement->getPoints();
  618.                 }
  619.             }
  620.         }
  621.         return $catalogPointsAmount;
  622.     }
  623.     public function __toString(): string
  624.     {
  625.         return $this->id $this->getUsername() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  626.     }
  627. }