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