選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

52 行
1.9KB

  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  4. use Lc\ShopBundle\Context\ProductInterface;
  5. use Lc\ShopBundle\Context\ReminderInterface;
  6. /**
  7. * @method ReminderInterface|null find($id, $lockMode = null, $lockVersion = null)
  8. * @method ReminderInterface|null findOneBy(array $criteria, array $orderBy = null)
  9. * @method ReminderInterface[] findAll()
  10. * @method ReminderInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  11. */
  12. class ReminderRepository extends BaseRepository implements DefaultRepositoryInterface
  13. {
  14. public function getInterfaceClass()
  15. {
  16. return ReminderInterface::class;
  17. }
  18. public function findByUser($user){
  19. $qb = $this->findByMerchantQuery()
  20. ->leftJoin('e.users','u')
  21. ->having('COUNT(u.id) = 0')
  22. ->orHaving(':user MEMBER OF e.users')
  23. ->andWhere('e.done = 0')
  24. ->setParameter('user', $user)
  25. ->orderBy('e.dateReminder', 'ASC')
  26. ->groupBy('e.id');
  27. return $qb->getQuery()->getResult();
  28. }
  29. public function findByEasyAdminConfig($action, $entity, $id = null){
  30. $qb = $this->findByMerchantQuery();
  31. $qb->andWhere('e.done = 0');
  32. $qb->andWhere('e.entityAction LIKE :action');
  33. $qb->andWhere('e.entityName LIKE :entity');
  34. $qb->setParameter('entity', $entity);
  35. $qb->setParameter('action', $action);
  36. if($id) {
  37. $qb->andWhere('e.entityId LIKE :id');
  38. $qb->setParameter('id', $id);
  39. }
  40. $qb->orderBy('e.dateReminder', 'ASC');
  41. return $qb->getQuery()->getResult();
  42. }
  43. }