Code Duplication    Length = 21-21 lines in 2 locations

src/Eccube/Controller/Admin/Content/BlockController.php 1 location

@@ 175-195 (lines=21) @@
172
173
        // ユーザーが作ったブロックのみ削除する
174
        // テンプレートが変更されていた場合、DBからはブロック削除されるがtwigファイルは残る
175
        if ($Block->getDeletableFlg() > 0) {
176
            $tplDir = $app['config']['block_realdir'];
177
            $file = $tplDir . '/' . $Block->getFileName() . '.twig';
178
            $fs = new Filesystem();
179
            if ($fs->exists($file)) {
180
                $fs->remove($file);
181
            }
182
            $app['orm.em']->remove($Block);
183
            $app['orm.em']->flush();
184
185
            $event = new EventArgs(
186
                array(
187
                    'Block' => $Block,
188
                ),
189
                $request
190
            );
191
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_BLOCK_DELETE_COMPLETE, $event);
192
193
            $app->addSuccess('admin.delete.complete', 'admin');
194
            \Eccube\Util\Cache::clear($app, false);
195
        }
196
197
198
        return $app->redirect($app->url('admin_content_block'));

src/Eccube/Controller/Admin/Content/PageController.php 1 location

@@ 186-206 (lines=21) @@
183
        }
184
185
        // ユーザーが作ったページのみ削除する
186
        if ($PageLayout->getEditFlg() == PageLayout::EDIT_FLG_USER) {
187
            $templatePath = $app['eccube.repository.page_layout']->getWriteTemplatePath(false);
188
            $file = $templatePath.'/'.$PageLayout->getFileName().'.twig';
189
            $fs = new Filesystem();
190
            if ($fs->exists($file)) {
191
                $fs->remove($file);
192
            }
193
            $app['orm.em']->remove($PageLayout);
194
            $app['orm.em']->flush();
195
196
            $event = new EventArgs(
197
                array(
198
                    'DeviceType' => $DeviceType,
199
                    'PageLayout' => $PageLayout,
200
                ),
201
                $request
202
            );
203
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_PAGE_DELETE_COMPLETE, $event);
204
205
            $app->addSuccess('admin.delete.complete', 'admin');
206
        }
207
208
        return $app->redirect($app->url('admin_content_page'));
209
    }