These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminBundle\Repository; |
||
4 | |||
5 | use Doctrine\ORM\EntityRepository; |
||
6 | use Kunstmaan\AdminBundle\Entity\AclChangeset; |
||
7 | |||
8 | /** |
||
9 | * ACL changeset repository |
||
10 | */ |
||
11 | class AclChangesetRepository extends EntityRepository |
||
12 | { |
||
13 | /** |
||
14 | * Find a changeset with status RUNNING |
||
15 | * |
||
16 | * @return null|AclChangeset |
||
17 | */ |
||
18 | View Code Duplication | public function findRunningChangeset() |
|
0 ignored issues
–
show
|
|||
19 | { |
||
20 | $qb = $this->createQueryBuilder('ac') |
||
21 | ->select('ac') |
||
22 | ->where('ac.status = :status') |
||
23 | ->addOrderBy('ac.id', 'ASC') |
||
24 | ->setMaxResults(1) |
||
25 | ->setParameter('status', AclChangeset::STATUS_RUNNING); |
||
26 | |||
27 | return $qb->getQuery()->getOneOrNullResult(); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Fetch the oldest acl changeset for state NEW |
||
32 | * |
||
33 | * @return null|AclChangeset |
||
34 | */ |
||
35 | View Code Duplication | public function findNewChangeset() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
36 | { |
||
37 | $qb = $this->createQueryBuilder('ac') |
||
38 | ->select('ac') |
||
39 | ->where('ac.status = :status') |
||
40 | ->addOrderBy('ac.id', 'ASC') |
||
41 | ->setMaxResults(1) |
||
42 | ->setParameter('status', AclChangeset::STATUS_NEW); |
||
43 | |||
44 | return $qb->getQuery()->getOneOrNullResult(); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Check if there are pending changesets |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | View Code Duplication | public function hasPendingChangesets() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
53 | { |
||
54 | $qb = $this->createQueryBuilder('ac') |
||
55 | ->select('count(ac)') |
||
56 | ->where('ac.status = :status') |
||
57 | ->setParameter('status', AclChangeset::STATUS_NEW); |
||
58 | |||
59 | return $qb->getQuery()->getSingleScalarResult() != 0; |
||
60 | } |
||
61 | } |
||
62 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.