Code Duplication    Length = 17-17 lines in 2 locations

src/Controller/Api/PerformanceEventsController.php 1 location

@@ 66-82 (lines=17) @@
63
64
        $performanceEventsTranslated = [];
65
66
        foreach ($performanceEvents as $performanceEvent) {
67
            $performanceEvent->setLocale($paramFetcher->get('locale'));
68
            $em->refresh($performanceEvent);
69
70
            $performanceEvent->getPerformance()->setLocale($paramFetcher->get('locale'));
71
            $em->refresh($performanceEvent->getPerformance());
72
73
            if ($performanceEvent->getTranslations()) {
74
                $performanceEvent->unsetTranslations();
75
            }
76
77
            if ($performanceEvent->getPerformance()->getTranslations()) {
78
                $performanceEvent->getPerformance()->unsetTranslations();
79
            }
80
81
            $performanceEventsTranslated[] = $performanceEvent;
82
        }
83
84
        $performanceEvents = $performanceEventsTranslated;
85

src/Controller/Api/PerformancesController.php 1 location

@@ 203-219 (lines=17) @@
200
        $roles = $performance->getRoles();
201
        $rolesTrans = [];
202
203
        foreach ($roles as $role) {
204
            $role->setLocale($paramFetcher->get('locale'));
205
            $em->refresh($role);
206
207
            if ($role->getTranslations()) {
208
                $role->unsetTranslations();
209
            }
210
211
            $role->getEmployee()->setLocale($paramFetcher->get('locale'));
212
            $em->refresh($role->getEmployee());
213
214
            if ($role->getEmployee()->getTranslations()) {
215
                $role->getEmployee()->unsetTranslations();
216
            }
217
218
            $rolesTrans[] = $role;
219
        }
220
        $roles = $rolesTrans;
221
222
        return $roles;