|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Doctrine\ORM\QueryBuilder;
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\UserInterface;
-
- /**
- * @method UserInterface|null find($id, $lockMode = null, $lockVersion = null)
- * @method UserInterface|null findOneBy(array $criteria, array $orderBy = null)
- * @method UserInterface[] findAll()
- * @method UserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class UserRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return UserInterface::class;
- }
-
- public function findByMerchantQuery() :QueryBuilder
- {
- return $this->createQueryBuilder('e')
- ->innerJoin('e.userMerchants', "userMerchants")
- ->andWhere('userMerchants.merchant = :currentMerchant')
- ->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ;
- }
-
- public function findAllByNewsletter($newsletter)
- {
- return $this->createQueryBuilder('e')
- ->where(':newsletter MEMBER OF e.newsletters')
- ->setParameter('newsletter', $newsletter->getId())
- ->innerJoin('e.userMerchants', 'um')
- ->andWhere('um.merchant = :merchant AND um.active = 1')
- ->setParameter('merchant', $newsletter->getMerchant())
- ->getQuery()
- ->getResult();
- }
-
- public function findByRole($role)
- {
- $qb = $this->createQueryBuilder('u')
- ->where('u.roles LIKE :roles')
- ->setParameter('roles', '%"' . $role . '"%');
-
- return $qb->getQuery()->getResult();
- }
-
- public function findByTicketTypesNotification($ticketType){
-
- $qb = $this->createQueryBuilder('u')
- ->where('u.ticketTypesNotification LIKE :ticketType')
- ->setParameter('ticketType', '%"' . $ticketType . '"%');
-
-
- return $qb->getQuery()->getResult();
-
- }
-
- }
|