當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::getMethod方法代碼示例

本文整理匯總了PHP中Thelia\Core\HttpFoundation\Request::getMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getMethod方法的具體用法?PHP Request::getMethod怎麽用?PHP Request::getMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Thelia\Core\HttpFoundation\Request的用法示例。


在下文中一共展示了Request::getMethod方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addForm

 /**
  * Add a new form to the error form context
  *
  * @param BaseForm $form the errored form
  * @return $this
  */
 public function addForm(BaseForm $form)
 {
     $formErrorInformation = $this->request->getSession()->getFormErrorInformation();
     $this->set(get_class($form) . ":" . $form->getType(), $form);
     // Set form error information
     $formErrorInformation[get_class($form) . ":" . $form->getType()] = ['data' => $this->cleanFormData($form->getForm()->getData()), 'hasError' => $form->hasError(), 'errorMessage' => $form->getErrorMessage(), 'method' => $this->request->getMethod(), 'timestamp' => time(), 'validation_groups' => $form->getForm()->getConfig()->getOption('validation_groups')];
     $this->request->getSession()->setFormErrorInformation($formErrorInformation);
     return $this;
 }
開發者ID:jeremyFreeAgent,項目名稱:thelia,代碼行數:15,代碼來源:ParserContext.php

示例2: addForm

 /**
  * Add a new form to the error form context
  *
  * @param BaseForm $form the errored form
  * @return $this
  */
 public function addForm(BaseForm $form)
 {
     $formErrorInformation = $this->request->getSession()->getFormErrorInformation();
     $this->set(get_class($form) . ":" . $form->getType(), $form);
     /** Remove unserializable objects \Symfony\Component\HttpFoundation\File\UploadedFile */
     $formData = $form->getForm()->getData();
     foreach ($formData as $idx => $value) {
         if ($value instanceof UploadedFile) {
             unset($formData[$idx]);
         }
     }
     // Set form error information
     $formErrorInformation[get_class($form) . ":" . $form->getType()] = ['data' => $formData, 'hasError' => $form->hasError(), 'errorMessage' => $form->getErrorMessage(), 'method' => $this->request->getMethod(), 'timestamp' => time(), 'validation_groups' => $form->getForm()->getConfig()->getOption('validation_groups')];
     $this->request->getSession()->setFormErrorInformation($formErrorInformation);
     return $this;
 }
開發者ID:NicolasMugnier,項目名稱:thelia,代碼行數:22,代碼來源:ParserContext.php


注:本文中的Thelia\Core\HttpFoundation\Request::getMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。