Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
29 | public function addIfNotExists( |
||
30 | InstitutionWithPersonalRaDetails $institutionWithPersonalRaDetails |
||
|
|||
31 | ) { |
||
32 | $existsQuery = $this->createQueryBuilder('ipr') |
||
33 | ->where('ipr.institution = :institution') |
||
34 | ->setParameter('institution', $institutionWithPersonalRaDetails->institution) |
||
35 | ->getQuery() |
||
36 | ->getOneOrNullResult(); |
||
37 | |||
38 | if ($existsQuery) { |
||
39 | return; |
||
40 | } |
||
41 | |||
42 | $em = $this->getEntityManager(); |
||
43 | $em->persist($institutionWithPersonalRaDetails); |
||
44 | $em->flush($institutionWithPersonalRaDetails); |
||
45 | } |
||
46 | } |
||
47 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.