Doctrine2WorkFlowActionRepository.php 840 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace WorkflowBundle\Repository;
  3. use \Doctrine\ORM\EntityRepository;
  4. class Doctrine2WorkFlowActionRepository extends EntityRepository
  5. {
  6. /**
  7. * @param array $criteria
  8. *
  9. * @return array
  10. */
  11. public function findAllBy($criteria = array())
  12. {
  13. $qb = $this->createQueryBuilder('Doctrine2WorkFlowAction');
  14. foreach ($criteria as $field => $value) {
  15. $qb->andWhere("Doctrine2WorkFlowAction.{$field} = :{$field}")->setParameter($field, $value);
  16. }
  17. return $qb->getQuery()->getResult();
  18. }
  19. /**
  20. * @param string $eventName
  21. * @param string $entityClass
  22. *
  23. * @return array
  24. */
  25. public function findAllByEventAndEntityClass($eventName, $entityClass)
  26. {
  27. return $this->findAllBy(compact('eventName', 'entityClass'));
  28. }
  29. }