|
- <?php
-
- namespace Lc\CaracoleBundle\Builder\User;
-
- use Lc\CaracoleBundle\Factory\User\UserPointSaleFactory;
- use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
- use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Builder\User\UserBuilder as SovUserBuilder;
-
- class UserBuilder extends SovUserBuilder
- {
-
- // linkUserToPointSale
- public function linkToPointSale(UserInterface $user, PointSaleInterface $pointSale): bool
- {
- if (!$this->userSolver->isLinkedToPointSale($user, $pointSale)) {
- $userPointSaleFactory = new UserPointSaleFactory();
- $userPointSale = $userPointSaleFactory->create($user, $pointSale);
-
- $this->entityManager->create($userPointSale);
- $this->entityManager->flush();
-
- return true;
- }
-
- return false;
- }
-
- public function setFavoriteMerchant(UserInterface $user, MerchantInterface $merchant)
- {
- $user->setFavoriteMerchant($merchant);
- $this->entityManager->update($user);
- $this->entityManager->flush();
- return true;
- }
- }
|