Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

39 rindas
1.1KB

  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. }