当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::addError方法代码示例

本文整理汇总了PHP中Eccube\Application::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::addError方法的具体用法?PHP Application::addError怎么用?PHP Application::addError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Eccube\Application的用法示例。


在下文中一共展示了Application::addError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * List, add, edit maker.
  *
  * @param Application $app
  * @param Request     $request
  * @param null        $id
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function index(Application $app, Request $request, $id = null)
 {
     $repos = $app['eccube.plugin.maker.repository.maker'];
     $TargetMaker = new Maker();
     if ($id) {
         $TargetMaker = $repos->find($id);
         if (!$TargetMaker) {
             log_error('The Maker not found!', array('Maker id' => $id));
             throw new NotFoundHttpException();
         }
     }
     $form = $app['form.factory']->createBuilder('admin_maker', $TargetMaker)->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         log_info('Maker add/edit start.');
         $status = $repos->save($TargetMaker);
         if ($status) {
             log_info('Maker add/edit success', array('Maker id' => $TargetMaker->getId()));
             $app->addSuccess('admin.plugin.maker.save.complete', 'admin');
             return $app->redirect($app->url('admin_plugin_maker_index'));
         } else {
             log_info('Maker add/edit fail!', array('Maker id' => $TargetMaker->getId()));
             $app->addError('admin.plugin.maker.save.error', 'admin');
         }
     }
     /**
      * @var ArrayCollection $arrMaker
      */
     $arrMaker = $app['eccube.plugin.maker.repository.maker']->findBy(array(), array('rank' => 'DESC'));
     return $app->render('Maker/Resource/template/admin/maker.twig', array('form' => $form->createView(), 'arrMaker' => $arrMaker, 'TargetMaker' => $TargetMaker));
 }
开发者ID:EC-CUBE,项目名称:maker-plugin,代码行数:40,代码来源:MakerController.php

示例2: download

 /**
  * 作成ボタンクリック時の処理
  * 帳票のPDFをダウンロードする
  *
  * @param Application $app
  * @param Request $request
  * @throws BadRequestHttpException
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function download(Application $app, Request $request)
 {
     // POSTでない場合は終了する
     if ('POST' !== $request->getMethod()) {
         throw new BadRequestHttpException();
     }
     $form = $app['form.factory']->createBuilder('admin_order_pdf')->getForm();
     $form->handleRequest($request);
     // validation
     if (!$form->isValid()) {
         return $app->render('OrderPdf/View/admin/order_pdf.twig', array('form' => $form->createView()));
     }
     // サービスの取得
     $service = $app['eccube.plugin.order_pdf.service.order_pdf'];
     // 購入情報からPDFを作成する
     $status = $service->makePdf($form->getData());
     // 異常終了した場合の処理
     if (!$status) {
         $service->close();
         $app->addError('admin.order_pdf.download.failure', 'admin');
         return $app->render('OrderPdf/View/admin/order_pdf.twig', array('form' => $form->createView()));
     }
     // ダウンロードする
     $response = new Response($service->outputPdf(), 200, array('content-type' => 'application/pdf'));
     // レスポンスヘッダーにContent-Dispositionをセットし、ファイル名をreceipt.pdfに指定
     $response->headers->set('Content-Disposition', 'attachment; filename="' . $service->getPdfFileName() . '"');
     return $response;
 }
开发者ID:k-yamamura,项目名称:order-pdf-plugin,代码行数:37,代码来源:OrderPdfController.php

示例3: index

 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();
         }
     }
     $form = $app['form.factory']->createBuilder('mail', $Mail)->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();
             $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));
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:26,代码来源:MailController.php

示例4: edit

 public function edit(Application $app, Request $request, $id)
 {
     $repos = $app['eccube.plugin.holiday.repository.holidayconfig'];
     $TargetHolidayConfig = new \Plugin\Holiday\Entity\HolidayConfig();
     if ($id) {
         $TargetHolidayConfig = $repos->find($id);
         if (!$TargetHolidayConfig) {
             throw new NotFoundHttpException();
         }
     }
     $form = $app['form.factory']->createBuilder('admin_holiday_config', $TargetHolidayConfig)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $status = $repos->save($TargetHolidayConfig);
             if ($status) {
                 $app->addSuccess('admin.holiday.save.complete', 'admin');
                 return $app->redirect($app->url('plugin_holiday_config'));
             } else {
                 $app->addError('admin.holiday.save.error', 'admin');
             }
         }
     }
     return $app->render('Holiday/View/admin/holiday_config.twig', array('form' => $form->createView(), 'TargetHolidayConfig' => $TargetHolidayConfig));
 }
开发者ID:ActiveFusions,项目名称:Holiday,代码行数:25,代码来源:ConfigController.php

示例5: index

 public function index(Application $app, Request $request, $class_name_id, $id = null)
 {
     //
     $ClassName = $app['eccube.repository.class_name']->find($class_name_id);
     if (!$ClassName) {
         throw new NotFoundHttpException();
     }
     if ($id) {
         $TargetClassCategory = $app['eccube.repository.class_category']->find($id);
         if (!$TargetClassCategory || $TargetClassCategory->getClassName() != $ClassName) {
             throw new NotFoundHttpException();
         }
     } else {
         $TargetClassCategory = new \Eccube\Entity\ClassCategory();
         $TargetClassCategory->setClassName($ClassName);
     }
     //
     $form = $app['form.factory']->createBuilder('admin_class_category', $TargetClassCategory)->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $status = $app['eccube.repository.class_category']->save($TargetClassCategory);
             if ($status) {
                 $app->addSuccess('admin.class_category.save.complete', 'admin');
                 return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
             } else {
                 $app->addError('admin.class_category.save.error', 'admin');
             }
         }
     }
     $ClassCategories = $app['eccube.repository.class_category']->getList($ClassName);
     return $app->render('Product/class_category.twig', array('form' => $form->createView(), 'ClassName' => $ClassName, 'ClassCategories' => $ClassCategories, 'TargetClassCategory' => $TargetClassCategory));
 }
开发者ID:nahaichuan,项目名称:ec-cube,代码行数:33,代码来源:ClassCategoryController.php

示例6: index

 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));
 }
开发者ID:ec-cube,项目名称:ec-cube,代码行数:31,代码来源:MailController.php

示例7: index

 public function index(Application $app, Request $request, $id)
 {
     $repos = $app['eccube.plugin.holiday.repository.holidayweek'];
     $TargetHolidayWeek = new \Plugin\Holiday\Entity\HolidayWeek();
     if ($id) {
         $TargetHolidayWeek = $repos->find($id);
         if (!$TargetHolidayWeek) {
             throw new NotFoundHttpException();
         }
         $TargetHolidayWeek->week = unserialize($TargetHolidayWeek->week);
     }
     $form = $app['form.factory']->createBuilder('admin_holiday_week', $TargetHolidayWeek)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             // 取得した曜日選択情報をシリアライズ
             $TargetHolidayWeek->week = serialize($TargetHolidayWeek->week);
             $status = $repos->save($TargetHolidayWeek);
             if ($status) {
                 $app->addSuccess('admin.holiday.save.complete', 'admin');
                 return $app->redirect($app->url('admin_holiday_week'));
             } else {
                 $app->addError('admin.holiday.save.error', 'admin');
             }
         }
     }
     return $app->render('Holiday/View/admin/week.twig', array('form' => $form->createView(), 'TargetHolidayWeek' => $TargetHolidayWeek));
 }
开发者ID:ActiveFusions,项目名称:Holiday,代码行数:28,代码来源:HolidayWeekController.php

示例8: index

 public function index(Application $app, Request $request, $id = null)
 {
     if ($id) {
         $TargetClassName = $app['eccube.repository.class_name']->find($id);
         if (!$TargetClassName) {
             throw new NotFoundHttpException();
         }
     } else {
         $TargetClassName = new \Eccube\Entity\ClassName();
     }
     $builder = $app['form.factory']->createBuilder('admin_class_name', $TargetClassName);
     $event = new EventArgs(array('builder' => $builder, 'TargetClassName' => $TargetClassName), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $status = $app['eccube.repository.class_name']->save($TargetClassName);
             if ($status) {
                 $event = new EventArgs(array('form' => $form, 'TargetClassName' => $TargetClassName), $request);
                 $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_COMPLETE, $event);
                 $app->addSuccess('admin.class_name.save.complete', 'admin');
                 return $app->redirect($app->url('admin_product_class_name'));
             } else {
                 $app->addError('admin.class_name.save.error', 'admin');
             }
         }
     }
     $ClassNames = $app['eccube.repository.class_name']->getList();
     return $app->render('Product/class_name.twig', array('form' => $form->createView(), 'ClassNames' => $ClassNames, 'TargetClassName' => $TargetClassName));
 }
开发者ID:shhirose,项目名称:ec-cube,代码行数:31,代码来源:ClassNameController.php

示例9: edit

 /**
  * 新着情報を登録・編集する。
  *
  * @param Application $app
  * @param Request $request
  * @param integer $id
  * @throws NotFoundHttpException
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     if ($id) {
         $News = $app['eccube.repository.news']->find($id);
         if (!$News) {
             throw new NotFoundHttpException();
         }
         $News->setLinkMethod((bool) $News->getLinkMethod());
     } else {
         $News = new \Eccube\Entity\News();
     }
     $form = $app['form.factory']->createBuilder('admin_news', $News)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $data = $form->getData();
             if (empty($data['url'])) {
                 $News->setLinkMethod(Constant::DISABLED);
             }
             $status = $app['eccube.repository.news']->save($News);
             if ($status) {
                 $app->addSuccess('admin.news.save.complete', 'admin');
                 return $app->redirect($app->url('admin_content_news'));
             }
             $app->addError('admin.news.save.error', 'admin');
         }
     }
     return $app->render('Content/news_edit.twig', array('form' => $form->createView(), 'News' => $News));
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:38,代码来源:NewsController.php

示例10: index

 public function index(Application $app, Request $request, $parent_id = null, $id = null)
 {
     if ($parent_id) {
         $Parent = $app['eccube.repository.category']->find($parent_id);
         if (!$Parent) {
             throw new NotFoundHttpException();
         }
     } else {
         $Parent = null;
     }
     if ($id) {
         $TargetCategory = $app['eccube.repository.category']->find($id);
         if (!$TargetCategory) {
             throw new NotFoundHttpException();
         }
         $Parent = $TargetCategory->getParent();
     } else {
         $TargetCategory = new \Eccube\Entity\Category();
         $TargetCategory->setParent($Parent);
         if ($Parent) {
             $TargetCategory->setLevel($Parent->getLevel() + 1);
         } else {
             $TargetCategory->setLevel(1);
         }
     }
     //
     $builder = $app['form.factory']->createBuilder('admin_category', $TargetCategory);
     $event = new EventArgs(array('builder' => $builder, 'Parent' => $Parent, 'TargetCategory' => $TargetCategory), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     //
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             if ($app['config']['category_nest_level'] < $TargetCategory->getLevel()) {
                 throw new BadRequestHttpException();
             }
             $status = $app['eccube.repository.category']->save($TargetCategory);
             if ($status) {
                 $event = new EventArgs(array('form' => $form, 'Parent' => $Parent, 'TargetCategory' => $TargetCategory), $request);
                 $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_INDEX_COMPLETE, $event);
                 $app->addSuccess('admin.category.save.complete', 'admin');
                 if ($Parent) {
                     return $app->redirect($app->url('admin_product_category_show', array('parent_id' => $Parent->getId())));
                 } else {
                     return $app->redirect($app->url('admin_product_category'));
                 }
             } else {
                 $app->addError('admin.category.save.error', 'admin');
             }
         }
     }
     $Children = $app['eccube.repository.category']->getList(null);
     $Categories = $app['eccube.repository.category']->getList($Parent);
     $TopCategories = $app['eccube.repository.category']->findBy(array('Parent' => null), array('rank' => 'DESC'));
     $category_count = $app['eccube.repository.category']->getTotalCount();
     return $app->render('Product/category.twig', array('form' => $form->createView(), 'Children' => $Children, 'Parent' => $Parent, 'Categories' => $Categories, 'TopCategories' => $TopCategories, 'TargetCategory' => $TargetCategory, 'category_count' => $category_count));
 }
开发者ID:shhirose,项目名称:ec-cube,代码行数:58,代码来源:CategoryController.php

示例11: edit

 /**
  * Create & Edit.
  *
  * @param Application $app
  * @param Request     $request
  * @param int         $id
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     /* @var RecommendProduct $Recommend */
     $Recommend = null;
     $Product = null;
     if (!is_null($id)) {
         // IDからおすすめ商品情報を取得する
         $Recommend = $app['eccube.plugin.recommend.repository.recommend_product']->find($id);
         if (!$Recommend) {
             $app->addError('admin.recommend.not_found', 'admin');
             log_info('The recommend product is not found.', array('Recommend id' => $id));
             return $app->redirect($app->url('admin_recommend_list'));
         }
         $Product = $Recommend->getProduct();
     }
     // formの作成
     /* @var Form $form */
     $form = $app['form.factory']->createBuilder('admin_recommend', $Recommend)->getForm();
     $form->handleRequest($request);
     $data = $form->getData();
     if ($form->isSubmitted() && $form->isValid()) {
         $service = $app['eccube.plugin.recommend.service.recommend'];
         if (is_null($data['id'])) {
             if ($status = $service->createRecommend($data)) {
                 $app->addSuccess('admin.plugin.recommend.register.success', 'admin');
                 log_info('Add the new recommend product success.', array('Product id' => $data['Product']->getId()));
             }
         } else {
             if ($status = $service->updateRecommend($data)) {
                 $app->addSuccess('admin.plugin.recommend.update.success', 'admin');
                 log_info('Update the recommend product success.', array('Recommend id' => $Recommend->getId(), 'Product id' => $data['Product']->getId()));
             }
         }
         if (!$status) {
             $app->addError('admin.recommend.not_found', 'admin');
             log_info('Failed the recommend product updating.', array('Product id' => $data['Product']->getId()));
         }
         return $app->redirect($app->url('admin_recommend_list'));
     }
     if (!empty($data['Product'])) {
         $Product = $data['Product'];
     }
     $arrProductIdByRecommend = $app['eccube.plugin.recommend.repository.recommend_product']->getRecommendProductIdAll();
     return $this->registerView($app, array('form' => $form->createView(), 'recommend_products' => json_encode($arrProductIdByRecommend), 'Product' => $Product));
 }
开发者ID:EC-CUBE,项目名称:Recommend-plugin,代码行数:54,代码来源:RecommendController.php

示例12: delete

 public function delete(Application $app, $id)
 {
     $Customer = $app['user'];
     // 別のお届け先削除
     if ($app['eccube.repository.customer_address']->deleteByCustomerAndId($Customer, $id)) {
         $app->addError('mypage.address.delete.failed');
     } else {
         $app->addSuccess('mypage.address.delete.complete');
     }
     return $app->redirect($app->url('mypage_delivery'));
 }
开发者ID:nanasess,项目名称:nagoya-eccube-study,代码行数:11,代码来源:DeliveryController.php

示例13: edit

 public function edit(Application $app, Request $request, $id = null)
 {
     $repos = $app['eccube.plugin.holiday.repository.holiday'];
     if ($id) {
         $Holiday = $repos->find($id);
         if (!$Holiday) {
             throw new NotFoundHttpException();
         }
     } else {
         $Holiday = new \Plugin\Holiday\Entity\Holiday();
     }
     $form = $app['form.factory']->createBuilder('admin_holiday', $Holiday)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             // 日付の妥当性チェック
             // 閏年への対応.
             if ($form->get('month')->getData() == 2 && $form->get('day')->getData() == 29) {
                 $valid_date = true;
             } else {
                 $valid_date = checkdate($form->get('month')->getData(), $form->get('day')->getData(), date('Y'));
             }
             if (!$valid_date) {
                 $app->addError('admin.holiday.invalid_day.error', 'admin');
             } else {
                 $status = $repos->save($Holiday);
                 if ($status) {
                     $app->addSuccess('admin.holiday.save.complete', 'admin');
                     return $app->redirect($app->url('admin_setting_shop_holiday'));
                 } else {
                     $app->addError('admin.holiday.save.error', 'admin');
                 }
             }
         }
     }
     return $app->render('Holiday/Resource/template/admin//holiday_edit.twig', array('form' => $form->createView(), 'holiday' => $Holiday));
 }
开发者ID:ActiveFusions,项目名称:Holiday-plugin,代码行数:37,代码来源:HolidayController.php

示例14: index

 public function index(Application $app)
 {
     $BaseInfo = $app['eccube.repository.base_info']->get();
     $form = $app['form.factory']->createBuilder('shop_master', $BaseInfo)->getForm();
     if ($app['request']->getMethod() === 'POST') {
         $form->handleRequest($app['request']);
         if ($form->isValid()) {
             $app['orm.em']->persist($BaseInfo);
             $app['orm.em']->flush();
             $app->addSuccess('admin.shop.save.complete', 'admin');
             return $app->redirect($app->url('admin_setting_shop'));
         }
         $app->addError('admin.shop.save.error', 'admin');
     }
     return $app->render('Setting/Shop/shop_master.twig', array('form' => $form->createView()));
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:16,代码来源:ShopController.php

示例15: index

 /**
  * @public
  * @param Application $app
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index(Application $app, Request $request, $id = null)
 {
     $err = '';
     $data = array();
     $method = $request->getMethod();
     $form = $app['form.factory']->createBuilder('appiaries_settings', null)->getForm();
     $app['eccube.plugin.appiaries.repository.settings']->get_settings($data, $err);
     // No problem with "no_data", "no_database_id", "no_app_id", or "no_app_token".
     if ($err && preg_match('/^no_(?:data|datastore_id|app_id|app_token)$/', $err)) {
         $err = '';
     }
     $queries = array();
     if (!$err && $method == 'POST') {
         $form->handleRequest($request);
         $queries = $form->getData();
         if (!$form->isValid()) {
             error_log('[AppiariesAdminPushControrller]   ' . $form->getErrors());
             $err = 'validation_failed';
         } else {
             $settings = new \Plugin\Appiaries\Entity\AppiariesSettings();
             $settings->setDatastoreId($queries['datastore_id']);
             $settings->setAppId($queries['app_id']);
             $settings->setAppToken($queries['app_token']);
             if (!$app['eccube.plugin.appiaries.repository.settings']->save($settings, $err)) {
                 error_log('[ConfigController]   ' . $err);
                 $err = 'settings_save_failed';
             } else {
                 $app->addSuccess('admin_appiaries_settings_save_success', 'admin');
                 $data['datastore_id'] = $queries['datastore_id'];
                 $data['app_id'] = $queries['app_id'];
                 $data['app_token'] = $queries['app_token'];
             }
             $settings = null;
         }
     }
     if ($err) {
         error_log('[ConfigController]   ' . $err);
         $app->addError('admin_appiaries_' . $err, 'admin');
     }
     $data['config_form'] = $form->createView();
     $err = null;
     $request = null;
     $form = null;
     $queries = null;
     return $app->render('Appiaries/templates/admin/config/index.twig', $data);
 }
开发者ID:appiaries,项目名称:appiaries-eccube-push-plugin,代码行数:52,代码来源:ConfigController.php


注:本文中的Eccube\Application::addError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。