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


PHP Service::getFormFactory方法代碼示例

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


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

示例1: create

 /**
  * {@inheritdoc}
  */
 public function create()
 {
     $builder = \Service::getFormFactory()->createNamedBuilder($this->getName(), 'form', null, $this->getFormOptions());
     $form = $this->build($builder)->getForm();
     if ($this->editing) {
         $this->fill($form, $this->editing);
     }
     return $form;
 }
開發者ID:blast007,項目名稱:bzion,代碼行數:12,代碼來源:ModelFormCreator.php

示例2: getObjectFromParameters

 /**
  * Find what to pass as an argument on an action
  *
  * @param ReflectionParameter $modelParameter  The model's parameter we want to investigate
  * @param ParameterBag        $routeParameters The route's parameters
  */
 protected function getObjectFromParameters($modelParameter, $routeParameters)
 {
     $refClass = $modelParameter->getClass();
     $paramName = $modelParameter->getName();
     if ($refClass !== null && $refClass->isSubclassOf("Model")) {
         // Look for the object's ID/slugs in the routeParameters array
         $model = $this->findModelInParameters($modelParameter, $routeParameters);
         if ($model !== null) {
             return $model;
         }
     }
     // $me -> currently logged in user
     if ($paramName == "me") {
         return self::getMe();
     }
     if ($refClass === null) {
         // No class provived by the method's definition, we don't know
         // what we should pass
         return null;
     }
     switch ($refClass->getName()) {
         case "Symfony\\Component\\HttpFoundation\\Request":
             return $this->getRequest();
         case "Symfony\\Component\\HttpFoundation\\Session\\Session":
             return $this->getRequest()->getSession();
         case "Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBag":
             return $this->getRequest()->getSession()->getFlashBag();
         case "Monolog\\Logger":
             return $this->getLogger();
         case "Symfony\\Component\\Form\\FormFactory":
             return Service::getFormFactory();
     }
     return null;
 }
開發者ID:bchhun,項目名稱:bzion,代碼行數:40,代碼來源:Controller.php

示例3: create

 /**
  * {@inheritDoc}
  */
 public function create()
 {
     $builder = \Service::getFormFactory()->createNamedBuilder('confirm_form');
     return $builder->add($this->action, 'submit')->add($this->action == 'Yes' ? 'No' : 'Cancel', 'submit')->add('original_url', 'hidden', array('data' => $this->originalUrl))->getForm();
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:8,代碼來源:ConfirmationFormCreator.php


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