|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\ProductInterface;
- use Lc\ShopBundle\Context\ReminderInterface;
-
-
- class ReminderRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return ReminderInterface::class;
- }
-
-
- public function findByUser($user){
- $qb = $this->findByMerchantQuery()
- ->leftJoin('e.users','u')
- ->having('COUNT(u.id) = 0')
- ->orHaving(':user MEMBER OF e.users')
- ->andWhere('e.done = 0')
- ->setParameter('user', $user)
- ->orderBy('e.dateReminder', 'ASC')
- ->groupBy('e.id');
-
- return $qb->getQuery()->getResult();
- }
-
- public function findByEasyAdminConfig($action, $entity, $id = null){
- $qb = $this->findByMerchantQuery();
- $qb->andWhere('e.done = 0');
- $qb->andWhere('e.entityAction LIKE :action');
- $qb->andWhere('e.entityName LIKE :entity');
- $qb->setParameter('entity', $entity);
- $qb->setParameter('action', $action);
- if($id) {
- $qb->andWhere('e.entityId LIKE :id');
- $qb->setParameter('id', $id);
- }
- $qb->orderBy('e.dateReminder', 'ASC');
- return $qb->getQuery()->getResult();
- }
-
- }
|