You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserBuilder.php 1.1KB

3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Lc\CaracoleBundle\Builder\User;
  3. use Lc\CaracoleBundle\Factory\User\UserPointSaleFactory;
  4. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  5. use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
  6. use Lc\SovBundle\Model\User\UserInterface;
  7. use Lc\SovBundle\Builder\User\UserBuilder as SovUserBuilder;
  8. class UserBuilder extends SovUserBuilder
  9. {
  10. // linkUserToPointSale
  11. public function linkToPointSale(UserInterface $user, PointSaleInterface $pointSale): bool
  12. {
  13. if (!$this->userSolver->isLinkedToPointSale($user, $pointSale)) {
  14. $userPointSaleFactory = new UserPointSaleFactory();
  15. $userPointSale = $userPointSaleFactory->create($user, $pointSale);
  16. $this->entityManager->create($userPointSale);
  17. $this->entityManager->flush();
  18. return true;
  19. }
  20. return false;
  21. }
  22. public function setFavoriteMerchant(UserInterface $user, MerchantInterface $merchant)
  23. {
  24. $user->setFavoriteMerchant($merchant);
  25. $this->entityManager->update($user);
  26. $this->entityManager->flush();
  27. return true;
  28. }
  29. }