ActionRepository.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace WorkflowBundle\Repository;
  3. use \Doctrine\ORM\EntityRepository;
  4. class ActionRepository extends EntityRepository
  5. {
  6. /**
  7. * @param string $eventName
  8. * @param string $objectClass
  9. *
  10. * @return array
  11. */
  12. public function findAllByEventAndObjectClass($eventName, $objectClass)
  13. {
  14. $qb = $this->createQueryBuilder('Action')
  15. ->andWhere('Action.event LIKE :eventName')->setParameter('eventName', "%{$eventName}%")
  16. ->andWhere('Action.objectClass = :objectClass')->setParameter('objectClass', $objectClass)
  17. ;
  18. return $qb->getQuery()->getResult();
  19. }
  20. /**
  21. * @param string $eventName
  22. * @param string $workflowName
  23. * @param string $eventReference
  24. *
  25. * @return array
  26. */
  27. public function findAllByEventAndWorkflowName($eventName, $workflowName, $eventReference)
  28. {
  29. $qb = $this->createQueryBuilder('Action')
  30. ->andWhere('Action.event LIKE :eventName')->setParameter('eventName', "%{$eventName}%")
  31. ->andWhere('Action.workflowName = :workflowName')->setParameter('workflowName', $workflowName)
  32. ->andWhere('Action.eventReference = :eventReference')->setParameter('eventReference', $eventReference)
  33. ;
  34. return $qb->getQuery()->getResult();
  35. }
  36. }