Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
23 | public function getLastByAction($action) |
||
24 | { |
||
25 | $q = $this->getEntityManager()->createQueryBuilder() |
||
26 | ->setMaxResults(1) |
||
27 | ->select('e') |
||
28 | ->from($this->getEntityName(), 'e') |
||
29 | ->where('e.action = :action') |
||
30 | ->orderBy('e.created ', 'desc') |
||
31 | ->setParameters(array('action' => $action)); |
||
32 | |||
33 | try { |
||
34 | return $q->getQuery()->getSingleResult(); |
||
35 | } catch (\Doctrine\ORM\NoResultException $e) { |
||
36 | return null; |
||
37 | } |
||
40 |