Code Duplication    Length = 17-17 lines in 2 locations

src/AppBundle/Controller/PerformanceEventsController.php 1 location

@@ 79-95 (lines=17) @@
76
77
        $performanceEventsTranslated = [];
78
79
        foreach ($performanceEvents as $performanceEvent) {
80
            $performanceEvent->setLocale($paramFetcher->get('locale'));
81
            $em->refresh($performanceEvent);
82
83
            $performanceEvent->getPerformance()->setLocale($paramFetcher->get('locale'));
84
            $em->refresh($performanceEvent->getPerformance());
85
86
            if ($performanceEvent->getTranslations()) {
87
                $performanceEvent->unsetTranslations();
88
            }
89
90
            if ($performanceEvent->getPerformance()->getTranslations()) {
91
                $performanceEvent->getPerformance()->unsetTranslations();
92
            }
93
94
            $performanceEventsTranslated[] = $performanceEvent;
95
        }
96
97
        $performanceEvents = $performanceEventsTranslated;
98

src/AppBundle/Controller/PerformancesController.php 1 location

@@ 253-269 (lines=17) @@
250
        $roles = $performance->getRoles();
251
        $rolesTrans = [];
252
253
        foreach ($roles as $role) {
254
            $role->setLocale($paramFetcher->get('locale'));
255
            $em->refresh($role);
256
257
            if ($role->getTranslations()) {
258
                $role->unsetTranslations();
259
            }
260
261
            $role->getEmployee()->setLocale($paramFetcher->get('locale'));
262
            $em->refresh($role->getEmployee());
263
264
            if ($role->getEmployee()->getTranslations()) {
265
                $role->getEmployee()->unsetTranslations();
266
            }
267
268
            $rolesTrans[] = $role;
269
        }
270
        $roles = $rolesTrans;
271
272
        return $roles;