Code Duplication    Length = 18-21 lines in 2 locations

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

src/AppBundle/Controller/EmployeesController.php 1 location

@@ 205-222 (lines=18) @@
202
203
        $rolesTranslated = [];
204
205
        foreach ($roles as $role) {
206
207
            /** @var Role $role */
208
            $role->setLocale($paramFetcher->get('locale'));
209
210
            $performance = $role->getPerformance();
211
            $performance->setLocale($paramFetcher->get('locale'));
212
213
            $em->refresh($role);
214
            $em->refresh($performance);
215
216
            if ($role->getTranslations()) {
217
                $role->unsetTranslations();
218
            }
219
            if ($performance->getTranslations()) {
220
                $performance->unsetTranslations();
221
            }
222
223
            $rolesTranslated[] = $role;
224
        }
225