Code Duplication    Length = 19-19 lines in 2 locations

src/AdminBundle/Controller/CmsBlockController.php 1 location

@@ 84-102 (lines=19) @@
81
     * @param Request $request
82
     * @return \Symfony\Component\HttpFoundation\Response
83
     */
84
    public function editAction(CmsBlock $block, Request $request)
85
    {
86
        $form = $this->createForm(new CmsBlockType(), $block);
87
        $form->handleRequest($request);
88
89
        if (!$form->isValid()) {
90
            return [
91
                'form' => $form->createView(),
92
                'entity' => $block,
93
            ];
94
        }
95
        $this->persist($block);
96
        $this->flush();
97
        // refresh cache
98
        $this->get('cache.default')->delete('cms_block.' . $block->getAlias());
99
        $this->addFlash("success", $this->get('translator')->trans('cms_block.flash.updated'));
100
101
        return $this->redirectToRoute('admin_cmsblock_index');
102
    }
103
104
    /**
105
     * Deletes a CmsBlock entity.

src/AdminBundle/Controller/UserController.php 1 location

@@ 86-104 (lines=19) @@
83
     * @param Request $request
84
     * @return \Symfony\Component\HttpFoundation\Response
85
     */
86
    public function editAction(User $user, Request $request)
87
    {
88
        $form = $this->createForm(new UserType(), $user);
89
        $form->handleRequest($request);
90
91
        if (!$form->isValid()) {
92
            return [
93
                'form' => $form->createView(),
94
                'entity' => $user,
95
            ];
96
        }
97
98
        $this->encodePassword($user);
99
        $this->persist($user);
100
        $this->flush();
101
        $this->addFlash("success", $this->get('translator')->trans('user.flash.updated'));
102
103
        return $this->redirectToRoute('admin_user_index');
104
    }
105
106
    /**
107
     * Deletes a User entity.