Eccube\Controller\Admin\Setting\Shop\MailController::index PHP Метод

index() публичный Метод

public index ( Application $app, Request $request, $id = null )
$app Eccube\Application
$request Symfony\Component\HttpFoundation\Request
    public function index(Application $app, Request $request, $id = null)
    {
        $Mail = null;
        if ($id) {
            $Mail = $app['orm.em']->getRepository('\\Eccube\\Entity\\MailTemplate')->find($id);
            if (is_null($Mail)) {
                throw new NotFoundHttpException();
            }
        }
        $builder = $app['form.factory']->createBuilder('mail', $Mail);
        $event = new EventArgs(array('builder' => $builder, 'Mail' => $Mail), $request);
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_MAIL_INDEX_INITIALIZE, $event);
        $form = $builder->getForm();
        $form['template']->setData($Mail);
        if ('POST' === $request->getMethod()) {
            $form->handleRequest($request);
            // 新規登録は現時点では未実装とする.
            if (is_null($Mail)) {
                $app->addError('admin.shop.mail.save.error', 'admin');
                return $app->redirect($app->url('admin_setting_shop_mail'));
            }
            if ($form->isValid()) {
                $app['orm.em']->flush();
                $event = new EventArgs(array('form' => $form, 'Mail' => $Mail), $request);
                $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_MAIL_INDEX_COMPLETE, $event);
                $app->addSuccess('admin.shop.mail.save.complete', 'admin');
                return $app->redirect($app->url('admin_setting_shop_mail_edit', array('id' => $id)));
            }
        }
        return $app->render('Setting/Shop/mail.twig', array('form' => $form->createView(), 'id' => $id));
    }
MailController