Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
47 | public function getMessages(array $types, $maxAttempts = 5) |
||
48 | { |
||
49 | $query = $this->registry->getManagerForClass($this->class)->getRepository($this->class) |
||
50 | ->createQueryBuilder('m') |
||
51 | ->where('m.state = :erroneousState') |
||
52 | ->andWhere('m.restartCount < :maxAttempts'); |
||
53 | |||
54 | $parameters = array( |
||
55 | 'erroneousState' => MessageInterface::STATE_ERROR, |
||
56 | 'maxAttempts' => $maxAttempts, |
||
57 | ); |
||
58 | |||
59 | if (count($types) > 0) { |
||
60 | $query->andWhere('m.type IN (:types)'); |
||
61 | $parameters['types'] = $types; |
||
62 | } |
||
63 | |||
64 | $query->setParameters($parameters); |
||
65 | |||
66 | return $query->getQuery()->execute(); |
||
67 | } |
||
68 | } |
||
69 |