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


PHP FormInterface::isSubmitted方法代码示例

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


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

示例1: handleGameDetailForm

 /**
  * @return Response|null
  */
 private function handleGameDetailForm(Request $request, FormInterface $form, GameDetailForm $formObject)
 {
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid() && !$form->get('dealGame')->isClicked()) {
         throw new BadRequestHttpException('invalid or missing submit action');
     }
     if ($form->isSubmitted() && $form->isValid() && $form->get('dealGame')->isClicked()) {
         $this->gameService->deal($formObject->getGameId());
         return $this->redirectToRoute(self::ROUTE_GAME_DETAIL, ['gameId' => $formObject->getGameId()]);
     }
     return;
 }
开发者ID:llvdl,项目名称:DominoSymfony,代码行数:15,代码来源:GameDetailController.php

示例2: registerUser

 /**
  * @param FormInterface $form
  * @return int|false ID of inserted data OR success
  */
 public function registerUser(FormInterface $form)
 {
     if ($this->encoder == null) {
         throw new \Exception("Encoder can not be NULL! Do you added the Encoder by using add_encoder() ??");
     }
     if ($form->isValid()) {
         $data = $form->getData();
         $entity = new GBUserEntry();
         $entity->setNick($data['nick']);
         $entity->setPass($this->encodePassword($entity, $data['password']));
         try {
             $this->emanager->persist($entity);
             $this->emanager->flush();
             return $entity->getUid();
         } catch (\Exception $ex) {
             $this->errormessage = $ex->getMessage();
             if (strstr($this->errormessage, "Duplicate")) {
                 $this->errormessage = "Dieser Nick wird bereits verwendet!";
             }
             return false;
         }
     } elseif ($form->isSubmitted()) {
         $this->errormessage = (string) $form->getErrors(true);
     }
     return false;
 }
开发者ID:sunsingle,项目名称:gaestebuchtest,代码行数:30,代码来源:LoginManager.php

示例3: handle

 public function handle(FormInterface $form, Request $request)
 {
     $form->handleRequest($request);
     if (!$form->isValid()) {
         return false;
     }
     $data = $form->getData();
     if ($form->isSubmitted()) {
         $user = $this->userManager->findUserByEmail($data['email']);
         if (is_null($user)) {
             $form->addError(new FormError($this->translator->trans('security.resetting.request.errors.email_not_found')));
             return false;
         }
         if ($user->isPasswordRequestNonExpired($this->tokenTll)) {
             $form->addError(new FormError($this->translator->trans('security.resetting.request.errors.password_already_requested')));
             return false;
         }
         if ($user->getConfirmationToken() === null) {
             $user->setConfirmationToken($this->tokenGenerator->generateToken());
         }
         $user->setPasswordRequestedAt(new \DateTime());
         $this->userManager->resettingRequest($user);
     }
     return true;
 }
开发者ID:neandher,项目名称:Symfony-Multiple-Authentication,代码行数:25,代码来源:ResettingRequestFormHandler.php

示例4: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['valid'] = $valid = !$form->isSubmitted() || $form->isValid();
     $view->vars['icon'] = $valid ? $options['icon'] : $options['error_icon'];
     $view->vars['tab_active'] = false;
     $view->parent->vars['vic_tabbed'] = true;
 }
开发者ID:global01,项目名称:victoire,代码行数:10,代码来源:TabType.php

示例5: buildView

 /**
  * Adds on constraints found in data class' metadata (yaml/xml/annotations)
  *
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     if (!$form->isSubmitted()) {
         if ($this->metaDataConstraintService instanceof MetaDataConstraintService) {
             $this->metaDataConstraintService->mergeConstraints($form);
         }
     }
 }
开发者ID:josephjbrewer,项目名称:form-utils,代码行数:13,代码来源:AbstractBaseForm.php

示例6: handleCreateGameForm

 /**
  * @param Request       $request
  * @param FormInterface $form
  *
  * @return Response|null
  */
 private function handleCreateGameForm(Request $request, FormInterface $form, CreateGameForm $formObject)
 {
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $gameId = $this->gameService->createGame($formObject->getName());
         return $this->redirectToRoute(self::ROUTE_GAME_DETAIL, ['gameId' => $gameId]);
     }
     return;
 }
开发者ID:llvdl,项目名称:DominoSymfony,代码行数:15,代码来源:GameOverviewController.php

示例7: validateForm

 /**
  * @param FormInterface $form
  */
 private function validateForm(FormInterface $form)
 {
     if (!$form->isSubmitted()) {
         throw new \InvalidArgumentException("FormCriteriaDecorator expects form to be submitted");
     }
     if (!$form->isValid()) {
         throw new \InvalidArgumentException("FormCriteriaDecorator expects form to be valid.");
     }
 }
开发者ID:karion,项目名称:mydrinks,代码行数:12,代码来源:SearchCriteriaDecorator.php

示例8: isFormSubmitted

 /**
  * @param FormInterface $form
  * @param Request $request
  * @return bool
  */
 protected function isFormSubmitted(FormInterface $form, Request $request)
 {
     if ($request->isMethod('POST')) {
         $form->handleRequest($request);
         return $form->isSubmitted();
     } else {
         return false;
     }
 }
开发者ID:WeavingTheWeb,项目名称:devobs,代码行数:14,代码来源:AbstractController.php

示例9: getCriteriaFromForm

 /**
  * @return array|mixed
  */
 protected function getCriteriaFromForm()
 {
     $criteria = [];
     if (null === $this->form) {
         return $criteria;
     }
     $this->form->handleRequest($this->request);
     if ($this->form->isSubmitted() && $this->form->isValid() || !$this->form->isSubmitted()) {
         $criteria = ArrayHelper::arrayForce($this->form->getData());
     }
     return $criteria;
 }
开发者ID:HNKSoftware,项目名称:FrameworkBundle,代码行数:15,代码来源:AbstractSearch.php

示例10: handle

 /**
  * @param FormInterface $form
  * @param Request       $request
  *
  * @return mixed|FormInterface
  */
 public function handle(FormInterface $form, Request $request)
 {
     $method = $request->getMethod();
     $form->submit($request, 'PATCH' !== $method);
     if ($form->isSubmitted() && $form->isValid()) {
         $entity = $form->getData();
         $this->registry->getManager()->persist($entity);
         $this->registry->getManager()->flush();
         return $entity;
     }
     return $form;
 }
开发者ID:hogosha,项目名称:hogosha,代码行数:18,代码来源:EntityFormHandler.php

示例11: getRegistryData

 /**
  * Gets the registry data given a submitted form.
  * Default configuration is returned if no form provided.
  *
  * @param FormInterface $form
  *
  * @return array
  *
  * @throws RuntimeException
  */
 public function getRegistryData(FormInterface $form = null)
 {
     $data = [];
     if (null !== $form) {
         if (!$form->isSubmitted()) {
             throw new RuntimeException('Form must have been submitted');
         }
         $newData = $form->getData();
         $data = $this->filterNullValues($newData);
     }
     return array_replace_recursive($this->getDefaultData(), $data);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:22,代码来源:RegistryManipulator.php

示例12: processPageForm

 /**
  * @param Request       $request
  * @param FormInterface $form
  *
  * @param Page          $page
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function processPageForm(Request $request, $form, $page = null)
 {
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $page = $form->getData();
         $em = $this->get('doctrine.orm.entity_manager');
         $em->persist($page);
         $em->flush();
         return $this->redirect($this->generateUrl('taforum_admin_page', array('pagePermalink' => $page->getPagePermalink())));
     }
     return $this->render('TerAelisForumBundle:Page:admin_page_edit.html.twig', array('page' => !empty($page) ? $page : null, 'form' => $form->createView()));
 }
开发者ID:teraelis,项目名称:forum,代码行数:20,代码来源:PageController.php

示例13: renderAdminForm

 /**
  * Render admin form and tag response with status 400 if form is badly completed
  *
  * @param FormInterface $form
  * @param array         $params additional view parameters
  * @param Response|null $response
  * @param string        $template
  *
  * @return Response
  */
 protected function renderAdminForm(FormInterface $form, array $params = array(), $response = null, $template = self::TEMPLATE)
 {
     if (is_null($response)) {
         $code = Response::HTTP_OK;
         if ($form->isSubmitted() && !$form->isValid()) {
             $code = Response::HTTP_UNPROCESSABLE_ENTITY;
         }
         $response = new Response('', $code, array('Content-type' => 'text/html; charset=utf-8'));
     }
     $params = array_merge($params, array('form' => $form->createView()));
     return $this->render($template, $params, $response);
 }
开发者ID:open-orchestra,项目名称:open-orchestra-cms-bundle,代码行数:22,代码来源:AbstractAdminController.php

示例14: create

 public function create(FormInterface $form, Request $request)
 {
     $form->handleRequest($request);
     if (!$form->isValid()) {
         return false;
     }
     $entity = $form->getData();
     if ($form->isSubmitted()) {
         if (!is_null($this->manager->checkUniqueEmail($entity->getUser()->getEmail()))) {
             $form->addError(new FormError('Email ja cadastrado!'));
             return false;
         }
     }
     $this->manager->create($entity);
     return true;
 }
开发者ID:neandher,项目名称:Symfony-Multiple-Authentication,代码行数:16,代码来源:GestorUserFormHandler.php

示例15: handlePlayerForm

 /**
  * @param Request       $request
  * @param FormInterface $form
  * @param GameDetailDto $game
  * @param PlayerDto     $player
  *
  * @return Response|null
  */
 private function handlePlayerForm(Request $request, FormInterface $form, GameDetail $game, Player $player)
 {
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         if ($form->get('play')->isClicked()) {
             $turnNumber = $form->getData()->getTurnNumber();
             $move = $form->getData()->getMove();
             if ($move && $move->isPlay()) {
                 $play = new Play($turnNumber, new Stone($move->getStoneTopValue(), $move->getStoneBottomValue()), $move->getSide() === 'left' ? Play::SIDE_LEFT : Play::SIDE_RIGHT);
                 $this->gameService->play($game->getId(), $player->getNumber(), $play);
                 return $this->redirectToRoute(self::ROUTE_PLAYER_DETAIL, ['gameId' => $form->getData()->getGameId(), 'playerNumber' => $form->getData()->getPlayerNumber()]);
             }
         }
     }
     return;
 }
开发者ID:llvdl,项目名称:DominoSymfony,代码行数:24,代码来源:PlayerController.php


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