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

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