GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 29-29 lines in 2 locations

src/AppBundle/Controller/AgreementController.php 1 location

@@ 129-157 (lines=29) @@
126
127
        $em = $this->getDoctrine()->getManager();
128
129
        if ($request->request->has('ids')) {
130
            try {
131
                $ids = $request->request->get('ids');
132
133
                $dates = $em->getRepository('AppBundle:Workday')->createQueryBuilder('w')
134
                    ->where('w.id IN (:ids)')
135
                    ->andWhere('w.agreement = :agreement')
136
                    ->setParameter('ids', $ids)
137
                    ->setParameter('agreement', $agreement)
138
                    ->getQuery()
139
                    ->getResult();
140
141
                /** @var Workday $date */
142
                foreach ($dates as $date) {
143
                    if ($date->getTrackedHours() === 0) {
144
                        $em->remove($date);
145
                    }
146
                }
147
                $em->flush();
148
149
                $agreement->setFromDate($this->getDoctrine()->getManager()->getRepository('AppBundle:Agreement')->getRealFromDate($agreement));
150
                $agreement->setToDate($this->getDoctrine()->getManager()->getRepository('AppBundle:Agreement')->getRealToDate($agreement));
151
152
                $em->flush();
153
                $this->addFlash('success', $this->get('translator')->trans('alert.deleted', [], 'calendar'));
154
            } catch (\Exception $e) {
155
                $this->addFlash('error', $this->get('translator')->trans('alert.not_deleted', [], 'calendar'));
156
            }
157
        }
158
        return $this->redirectToRoute('agreement_calendar', ['id' => $agreement->getId()]);
159
    }
160

src/AppBundle/Controller/GroupController.php 1 location

@@ 197-225 (lines=29) @@
194
195
        $em = $this->getDoctrine()->getManager();
196
197
        if ($request->request->has('ids')) {
198
            try {
199
                $ids = $request->request->get('ids');
200
201
                $dates = $em->getRepository('AppBundle:Workday')->createQueryBuilder('w')
202
                    ->where('w.id IN (:ids)')
203
                    ->andWhere('w.agreement = :agreement')
204
                    ->setParameter('ids', $ids)
205
                    ->setParameter('agreement', $agreement)
206
                    ->getQuery()
207
                    ->getResult();
208
209
                /** @var Workday $date */
210
                foreach ($dates as $date) {
211
                    if ($date->getTrackedHours() === 0) {
212
                        $em->remove($date);
213
                    }
214
                }
215
                $em->flush();
216
217
                $agreement->setFromDate($this->getDoctrine()->getManager()->getRepository('AppBundle:Agreement')->getRealFromDate($agreement));
218
                $agreement->setToDate($this->getDoctrine()->getManager()->getRepository('AppBundle:Agreement')->getRealToDate($agreement));
219
220
                $em->flush();
221
                $this->addFlash('success', $this->get('translator')->trans('alert.deleted', [], 'calendar'));
222
            } catch (\Exception $e) {
223
                $this->addFlash('error', $this->get('translator')->trans('alert.not_deleted', [], 'calendar'));
224
            }
225
        }
226
        return $this->redirectToRoute('admin_group_student_calendar', ['id' => $agreement->getId()]);
227
    }
228