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


PHP FormInterface::bind方法代碼示例

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


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

示例1: process

 /**
  * Process method for handler
  * @param Channel $channel
  *
  * @return boolean
  */
 public function process(Channel $channel)
 {
     $this->form->setData($channel);
     if ($this->request->isMethod('POST')) {
         $this->form->bind($this->request);
         if ($this->form->isValid()) {
             $this->onSuccess($channel);
             return true;
         }
     }
     return false;
 }
開發者ID:javiersantos,項目名稱:pim-community-dev,代碼行數:18,代碼來源:ChannelHandler.php

示例2: process

 /**
  * @param UserInterface $user
  * @return bool
  */
 public function process(UserInterface $user)
 {
     $this->form->setData(new ChangePassword());
     if ('POST' === $this->request->getMethod()) {
         $this->form->bind($this->request);
         if ($this->form->isValid()) {
             $this->onSuccess($user);
             return true;
         }
     }
     return false;
 }
開發者ID:spirit-dev,項目名稱:dbox-user,代碼行數:16,代碼來源:ResettingFormHandler.php

示例3: process

 /**
  * Process method for handler
  * @param AttributeGroup $group
  *
  * @return boolean
  */
 public function process(AttributeGroup $group)
 {
     $this->form->setData($group);
     if ($this->request->isMethod('POST')) {
         $this->form->bind($this->request);
         if ($this->form->isValid()) {
             $this->onSuccess($group);
             return true;
         }
     }
     return false;
 }
開發者ID:javiersantos,項目名稱:pim-community-dev,代碼行數:18,代碼來源:AttributeGroupHandler.php

示例4: process

 public function process(FormInterface $form)
 {
     if ('POST' == $this->request->getMethod()) {
         $form->bind($this->request);
         if ($form->isValid()) {
             return $this->onSuccess($form->getData());
         }
     }
     return false;
 }
開發者ID:qushe-demon,項目名稱:ghost,代碼行數:10,代碼來源:TopicFormHandler.php

示例5: isValid

 /**
  * {@inheritDoc}
  */
 public function isValid(FormInterface $form)
 {
     $request = $this->getRequest();
     if ($request->isMethod('POST') && !in_array($this->getRequestedTransition(), array(self::TRANSITION_BACK, self::TRANSITION_RESET))) {
         $form->bind($request);
         if ($this->hasListeners(FormFlowEvents::POST_BIND_REQUEST)) {
             $event = new PostBindRequestEvent($this, $form->getData(), $this->currentStepNumber);
             $this->eventDispatcher->dispatch(FormFlowEvents::POST_BIND_REQUEST, $event);
         }
         if ($form->isValid()) {
             if ($this->hasListeners(FormFlowEvents::POST_VALIDATE)) {
                 $event = new PostValidateEvent($this, $form->getData());
                 $this->eventDispatcher->dispatch(FormFlowEvents::POST_VALIDATE, $event);
             }
             return true;
         }
     }
     return false;
 }
開發者ID:gsdevme,項目名稱:CraueFormFlowBundle,代碼行數:22,代碼來源:FormFlow.php

示例6: doAuthentication

 private function doAuthentication(PhraseaApplication $app, Request $request, FormInterface $form, $redirector)
 {
     if (!is_callable($redirector)) {
         throw new InvalidArgumentException('Redirector should be callable');
     }
     $context = new Context(Context::CONTEXT_NATIVE);
     $app['dispatcher']->dispatch(PhraseaEvents::PRE_AUTHENTICATE, new PreAuthenticate($request, $context));
     $form->bind($request);
     if (!$form->isValid()) {
         $app->addFlash('error', $app->trans('An unexpected error occured during authentication process, please contact an admin'));
         throw new AuthenticationException(call_user_func($redirector));
     }
     $params = [];
     if (null !== ($redirect = $request->get('redirect'))) {
         $params['redirect'] = ltrim($redirect, '/');
     }
     try {
         $usr_id = $app['auth.native']->getUsrId($request->request->get('login'), $request->request->get('password'), $request);
     } catch (RequireCaptchaException $e) {
         $app->requireCaptcha();
         $app->addFlash('warning', $app->trans('Please fill the captcha'));
         throw new AuthenticationException(call_user_func($redirector, $params));
     } catch (AccountLockedException $e) {
         $app->addFlash('warning', $app->trans('login::erreur: Vous n\'avez pas confirme votre email'));
         $app->addUnlockAccountData($e->getUsrId());
         throw new AuthenticationException(call_user_func($redirector, $params));
     }
     if (null === $usr_id) {
         $app['session']->getFlashBag()->set('error', $app->trans('login::erreur: Erreur d\'authentification'));
         throw new AuthenticationException(call_user_func($redirector, $params));
     }
     $user = $app['manipulator.user']->getRepository()->find($usr_id);
     $session = $this->postAuthProcess($app, $user);
     $response = $this->generateAuthResponse($app, $app['browser'], $request->request->get('redirect'));
     $response->headers->clearCookie('invite-usr-id');
     if ($request->cookies->has('postlog') && $request->cookies->get('postlog') == '1') {
         if (!$user->isGuest() && $request->cookies->has('invite-usr_id')) {
             if ($user->getId() != ($inviteUsrId = $request->cookies->get('invite-usr_id'))) {
                 $repo = $app['EM']->getRepository('Phraseanet:Basket');
                 $baskets = $repo->findBy(['usr_id' => $inviteUsrId]);
                 foreach ($baskets as $basket) {
                     $basket->setUser($user);
                     $app['EM']->persist($basket);
                 }
             }
         }
     }
     if ($request->request->get('remember-me') == '1') {
         $nonce = \random::generatePassword(16);
         $string = $app['browser']->getBrowser() . '_' . $app['browser']->getPlatform();
         $token = $app['auth.password-encoder']->encodePassword($string, $nonce);
         $session->setToken($token)->setNonce($nonce);
         $response->headers->setCookie(new Cookie('persistent', $token));
         $app['EM']->persist($session);
         $app['EM']->flush();
     }
     $event = new PostAuthenticate($request, $response, $user, $context);
     $app['dispatcher']->dispatch(PhraseaEvents::POST_AUTHENTICATE, $event);
     return $event->getResponse();
 }
開發者ID:romainneutron,項目名稱:Phraseanet,代碼行數:60,代碼來源:Login.php


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