Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 105-129 (lines=25) @@
102
103
        if ('POST' === $request->getMethod()) {
104
            $form->handleRequest($request);
105
            if ($form->isValid()) {
106
                $data = $form->getData();
107
                if (empty($data['url'])) {
108
                    $News->setLinkMethod(Constant::DISABLED);
109
                }
110
111
                $status = $app['eccube.repository.news']->save($News);
112
113
                if ($status) {
114
115
                    $event = new EventArgs(
116
                        array(
117
                            'form' => $form,
118
                            'News' => $News,
119
                        ),
120
                        $request
121
                    );
122
                    $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_NEWS_EDIT_COMPLETE, $event);
123
124
                    $app->addSuccess('admin.news.save.complete', 'admin');
125
126
                    return $app->redirect($app->url('admin_content_news'));
127
                }
128
                $app->addError('admin.news.save.error', 'admin');
129
            }
130
        }
131
132
        return $app->render('Content/news_edit.twig', array(

src/Eccube/Controller/Admin/Setting/Shop/TaxRuleController.php 1 location

@@ 179-202 (lines=24) @@
176
177
        $form = $builder->getForm();
178
179
        if ('POST' === $request->getMethod()) {
180
            $form->handleRequest($request);
181
182
            // 軽減税率設定の項目のみ処理する
183
            $optionForm = $form->get('option_product_tax_rule');
184
            if ($optionForm->isValid()) {
185
                /** @var  $BaseInfo \Eccube\Entity\BaseInfo */
186
                $BaseInfo = $app['eccube.repository.base_info']->get();
187
                $BaseInfo->setOptionProductTaxRule($optionForm->getData());
188
189
                $app['orm.em']->flush();
190
191
                $event = new EventArgs(
192
                    array(
193
                        'form' => $form,
194
                        'BaseInfo' => $BaseInfo,
195
                    ),
196
                    $request
197
                );
198
                $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_TAX_RULE_EDIT_PARAMETER_COMPLETE, $event);
199
200
                $app->addSuccess('admin.shop.tax.save.complete', 'admin');
201
            }
202
        }
203
204
        return $app->redirect($app->url('admin_setting_shop_tax'));
205
    }