|
1234567891011121314151617181920212223242526272829 |
- <?php
-
- namespace Lc\CaracoleBundle\Builder\User;
-
- use Doctrine\ORM\EntityManagerInterface;
- use Lc\CaracoleBundle\Factory\User\UserPointSaleFactory;
- use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Builder\User\UserBuilder as SovUserBuilder;
-
- class UserBuilder extends SovUserBuilder
- {
-
- public function linkToPointSale(UserInterface $user, PointSaleInterface $pointSale)
- {
- if (!$user->isLinkedToPointSale($pointSale)) {
- $userPointSaleFactory = new UserPointSaleFactory();
- $userPointSale = $userPointSaleFactory->create($user, $pointSale);
-
- $this->entityManager->persist($userPointSale);
- $this->entityManager->flush();
-
- return true;
- }
-
- return false;
- }
- }
-
|