Code Duplication    Length = 18-21 lines in 2 locations

src/AppBundle/Controller/EmployeesController.php 1 location

@@ 238-255 (lines=18) @@
235
236
        $rolesTranslated = [];
237
238
        foreach ($roles as $role) {
239
            $role->setLocale($paramFetcher->get('locale'));
240
241
            $performance = $role->getPerformance();
242
            $performance->setLocale($paramFetcher->get('locale'));
243
244
            $em->refresh($role);
245
            $em->refresh($performance);
246
247
            if ($role->getTranslations()) {
248
                $role->unsetTranslations();
249
            }
250
            if ($performance->getTranslations()) {
251
                $performance->unsetTranslations();
252
            }
253
254
            $rolesTranslated[] = $role;
255
        }
256
257
        $roles = $rolesTranslated;
258

src/AppBundle/Controller/PostsController.php 1 location

@@ 59-79 (lines=21) @@
56
57
        $postsTranslated = [];
58
59
        foreach ($posts as $post) {
60
            $post->setLocale($paramFetcher->get('locale'));
61
            $em->refresh($post);
62
63
            if ($post->getTranslations()) {
64
                $post->unsetTranslations();
65
            }
66
67
            $tags = $post->getTags();
68
69
            foreach ($tags as $tag) {
70
                $tag->setLocale($paramFetcher->get('locale'));
71
                $em->refresh($tag);
72
73
                if ($tag->getTranslations()) {
74
                    $tag->unsetTranslations();
75
                }
76
            }
77
78
            $postsTranslated[] = $post;
79
        }
80
81
        $posts = $postsTranslated;
82