Code Duplication    Length = 9-10 lines in 8 locations

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/UnverifiedSecondFactorRepository.php 1 location

@@ 63-71 (lines=9) @@
60
        return $queryBuilder->getQuery();
61
    }
62
63
    public function removeByIdentityId(IdentityId $identityId)
64
    {
65
        $this->getEntityManager()->createQueryBuilder()
66
            ->delete($this->_entityName, 'sf')
67
            ->where('sf.identityId = :identityId')
68
            ->setParameter('identityId', $identityId->getIdentityId())
69
            ->getQuery()
70
            ->execute();
71
    }
72
73
    /**
74
     * @param UnverifiedSecondFactor $secondFactor

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/VettedSecondFactorRepository.php 1 location

@@ 58-66 (lines=9) @@
55
        return $queryBuilder->getQuery();
56
    }
57
58
    public function removeByIdentityId(IdentityId $identityId)
59
    {
60
        $this->getEntityManager()->createQueryBuilder()
61
            ->delete($this->_entityName, 'sf')
62
            ->where('sf.identityId = :identityId')
63
            ->setParameter('identityId', $identityId->getIdentityId())
64
            ->getQuery()
65
            ->execute();
66
    }
67
68
    /**
69
     * @param VettedSecondFactor $secondFactor

src/Surfnet/StepupMiddleware/GatewayBundle/Repository/SecondFactorRepository.php 1 location

@@ 55-63 (lines=9) @@
52
        return $this->findBy(['identityId' => (string) $identityId]);
53
    }
54
55
    public function removeByIdentityId(IdentityId $identityId)
56
    {
57
        $this->getEntityManager()->createQueryBuilder()
58
            ->delete($this->_entityName, 'sf')
59
            ->where('sf.identityId = :identityId')
60
            ->setParameter('identityId', $identityId->getIdentityId())
61
            ->getQuery()
62
            ->execute();
63
    }
64
65
    /**
66
     * @param SecondFactor $secondFactor

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/AuditLogRepository.php 1 location

@@ 118-126 (lines=9) @@
115
     * @param IdentityId $identityId
116
     * @return void
117
     */
118
    public function removeByIdentityId(IdentityId $identityId)
119
    {
120
        $this->getEntityManager()->createQueryBuilder()
121
            ->delete($this->_entityName, 'al')
122
            ->where('al.identityId = :identityId')
123
            ->setParameter('identityId', $identityId->getIdentityId())
124
            ->getQuery()
125
            ->execute();
126
    }
127
128
    /**
129
     * @param AuditLogEntry $entry

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/IdentityRepository.php 1 location

@@ 163-171 (lines=9) @@
160
                ->getSingleResult();
161
    }
162
163
    public function removeByIdentityId(IdentityId $identityId)
164
    {
165
        $this->getEntityManager()->createQueryBuilder()
166
            ->delete($this->_entityName, 'i')
167
            ->where('i.id = :identityId')
168
            ->setParameter('identityId', $identityId->getIdentityId())
169
            ->getQuery()
170
            ->execute();
171
    }
172
173
    /**
174
     * @param Institution $institution

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/RaListingRepository.php 1 location

@@ 154-163 (lines=10) @@
151
     * @param IdentityId $identityId
152
     * @return void
153
     */
154
    public function removeByIdentityId(IdentityId $identityId)
155
    {
156
        $this->getEntityManager()->createQueryBuilder()
157
            ->delete($this->_entityName, 'ral')
158
            ->where('ral.identityId = :identityId')
159
            ->andWhere('ral.raInstitution = :institution')
160
            ->setParameter('identityId', $identityId->getIdentityId())
161
            ->getQuery()
162
            ->execute();
163
    }
164
165
    /**
166
     * @param IdentityId $identityId

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/VerifiedSecondFactorRepository.php 1 location

@@ 137-145 (lines=9) @@
134
        return $queryBuilder->getQuery();
135
    }
136
137
    public function removeByIdentityId(IdentityId $identityId)
138
    {
139
        $this->getEntityManager()->createQueryBuilder()
140
            ->delete($this->_entityName, 'sf')
141
            ->where('sf.identityId = :identityId')
142
            ->setParameter('identityId', $identityId->getIdentityId())
143
            ->getQuery()
144
            ->execute();
145
    }
146
147
    /**
148
     * @param VerifiedSecondFactor $secondFactor

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Repository/RaSecondFactorRepository.php 1 location

@@ 165-173 (lines=9) @@
162
     * @param IdentityId $identityId
163
     * @return void
164
     */
165
    public function removeByIdentityId(IdentityId $identityId)
166
    {
167
        $this->getEntityManager()->createQueryBuilder()
168
            ->delete($this->_entityName, 'rasf')
169
            ->where('rasf.identityId = :identityId')
170
            ->setParameter('identityId', $identityId->getIdentityId())
171
            ->getQuery()
172
            ->execute();
173
    }
174
175
    public function save(RaSecondFactor $secondFactor)
176
    {