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


PHP Form::submit方法代码示例

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


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

示例1: process

 /**
  *
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $formData = $this->form->getData();
         $name = (string) $formData->getName();
         if ($name) {
             $this->qb->andWhere($this->qb->expr()->like('p.name', ':name'))->setParameter('name', '%' . $name . '%');
         }
         $text = (string) $formData->getText();
         if ($text) {
             $this->qb->andWhere($this->qb->expr()->orx($this->qb->expr()->like('p.intro', ':intro'), $this->qb->expr()->like('p.content', ':content')))->setParameter('intro', '%' . $text . '%')->setParameter('content', '%' . $text . '%');
         }
         $isPublished = (string) $formData->getIsPublished();
         if ($isPublished) {
             if ($isPublished == 'yes') {
                 $this->qb->andWhere($this->qb->expr()->eq('p.status', ':status'))->setParameter('status', PostStatus::PUBLISHED);
             }
             if ($isPublished == 'no') {
                 $this->qb->andWhere($this->qb->expr()->neq('p.status', ':status'))->setParameter('status', PostStatus::PUBLISHED);
             }
         }
         $order = (string) $formData->getOrder();
         if ($order) {
             $this->qb->orderBy('p.' . $order, 'DESC');
         }
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:34,代码来源:PostFilterHandler.php

示例2: testValid

 public function testValid()
 {
     $this->sut->submit(['fullName' => 'James T. Kirk', 'location' => 'San Francisco', 'placeOfBirth' => 'Iowa']);
     foreach ($this->sut as $name => $child) {
         $this->assertTrue($child->isValid(), $name);
     }
     $this->assertTrue($this->sut->isValid());
 }
开发者ID:xtrasmal,项目名称:iinano,代码行数:8,代码来源:ProfileTypeTest.php

示例3: process

 /**
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $query = $this->form->getData()->getQuery();
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:12,代码来源:SearchHandler.php

示例4: process

 /**
  *
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $this->entity = $this->form->getData();
         $this->em->persist($this->entity);
         $this->em->flush();
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:15,代码来源:LinkHandler.php

示例5: process

 /**
  *
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $formData = $this->form->getData();
         if ($name = (string) $formData->name) {
             $this->qb->andWhere($this->qb->expr()->like('t.name', ':name'))->setParameter('name', '%' . $name . '%');
         }
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:16,代码来源:TagFilterHandler.php

示例6: process

 /**
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $entityModel = $this->form->getData();
         $this->entity->setContent($this->sanitizer->doClean($entityModel->getContent()));
         $this->entity->setUserName($this->sanitizer->doClean($entityModel->getUserName()));
         $this->entity->setUserEmail($this->sanitizer->doClean($entityModel->getUserEmail()));
         $this->entity->setUserWeb($this->sanitizer->doClean($entityModel->getUserWeb()));
         $this->em->persist($this->entity);
         $this->em->flush();
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:18,代码来源:CommentHandler.php

示例7: process

 /**
  *
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $entityModel = $this->form->getData();
         $file = $entityModel->getFile();
         $fileName = $this->getName() . '.' . $file->getClientOriginalExtension();
         $file->move($this->uploadPath, $fileName);
         $this->entity->setFile($fileName);
         $this->em->persist($this->entity);
         $this->em->flush();
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:19,代码来源:ImageHandler.php

示例8: process

 /**
  * @param UserInterface $user
  *
  * @return bool
  */
 public function process(UserInterface $user)
 {
     $this->form->setData($user);
     if ('POST' == $this->request->getMethod()) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $this->onSuccess($user);
             return true;
         }
         // Reloads the user to reset its username. This is needed when the
         // username or password have been changed to avoid issues with the
         // security layer.
         $this->userManager->reloadUser($user);
     }
     return false;
 }
开发者ID:morille,项目名称:SonataUserBundle,代码行数:21,代码来源:ProfileFormHandler.php

示例9: handleForm

 private function handleForm(Request $request, Form $form, $id, $command)
 {
     $form->submit($request);
     if ($form->isValid()) {
         $this->handleCommand($command);
         return $this->redirectView($this->router->generate('get_game', array('id' => $id)), Codes::HTTP_CREATED);
     }
     return $form;
 }
开发者ID:weemen,项目名称:hangman_lennard,代码行数:9,代码来源:DefaultController.php

示例10: processForm

 /**
  * @param Request $request
  * @param Form $form
  */
 protected function processForm(Request $request, Form $form)
 {
     $data = json_decode($request->getContent(), true);
     if ($data === null) {
         $apiProblem = new ApiProblem(Response::HTTP_BAD_REQUEST, ApiProblem::TYPE_INVALID_REQUEST_BODY_FORMAT);
         throw new ApiProblemException($apiProblem);
     }
     $clearMissing = $request->getMethod() !== 'PATCH';
     $form->submit($data, $clearMissing);
 }
开发者ID:C3-TKO,项目名称:smash-api,代码行数:14,代码来源:BaseController.php

示例11: process

 /**
  * Process current form
  * @return boolean
  */
 public function process()
 {
     $success = false;
     if ($this->request->getMethod() == 'POST' || $this->request->getMethod() == 'PUT') {
         // Correct HTTP method => try to process form
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             // Form is valid => create or update the path
             $this->data = $this->form->getData();
             if ($this->request->getMethod() == 'POST') {
                 // Create path
                 $success = $this->create();
             } else {
                 // Edit existing path
                 $success = $this->edit();
             }
         }
     }
     return $success;
 }
开发者ID:CPASimUSante,项目名称:PathBundle,代码行数:24,代码来源:AbstractHandler.php

示例12: process

 /**
  *
  * @return boolean
  */
 public function process()
 {
     $this->form->submit($this->request);
     if ($this->form->isValid()) {
         $formData = $this->form->getData();
         if ($name = (string) $formData->name) {
             $this->qb->andWhere($this->qb->expr()->like('l.name', ':name'))->setParameter('name', '%' . $name . '%');
         }
         if ($isPublished = (string) $formData->isPublished) {
             if ($isPublished == 'yes') {
                 $this->qb->andWhere($this->qb->expr()->like('l.isPublished', ':isPublished'))->setParameter('isPublished', 1);
             }
             if ($isPublished == 'no') {
                 $this->qb->andWhere($this->qb->expr()->like('l.isPublished', ':isPublished'))->setParameter('isPublished', 0);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:radutopala,项目名称:BlogBundle,代码行数:24,代码来源:LinkFilterHandler.php

示例13: eventListener

 /**
  * Listen privet form
  * @param Request $request
  * @return bool
  */
 private function eventListener(Request $request)
 {
     $this->rq = $request;
     if ($request->isMethod("post")) {
         $this->form->submit($this->rq);
         if ($this->rq->isXmlHttpRequest()) {
             $this->ajax = true;
         }
         return true;
     }
     return false;
 }
开发者ID:fire1,项目名称:liby,代码行数:17,代码来源:Image.php

示例14: validate

 /**
  * validate
  *
  * @param Form    $form    Form
  * @param Request $request Request
  *
  * @return boolean
  */
 public function validate(Form $form, Request $request)
 {
     if ($this->hasMethod($request->getMethod())) {
         if ($request->getMethod() != 'POST') {
             $form->submit($request);
         } else {
             $form->handleRequest($request);
         }
         return $form->isValid();
     }
     return false;
 }
开发者ID:sogevia,项目名称:component-form,代码行数:20,代码来源:FormHandler.php

示例15: testDataIsInitializedFromSubmit

 public function testDataIsInitializedFromSubmit()
 {
     $mock = $this->getMockBuilder('\\stdClass')->setMethods(array('preSetData', 'preSubmit'))->getMock();
     $mock->expects($this->at(0))->method('preSetData');
     $mock->expects($this->at(1))->method('preSubmit');
     $config = new FormConfigBuilder('name', null, $this->dispatcher);
     $config->addEventListener(FormEvents::PRE_SET_DATA, array($mock, 'preSetData'));
     $config->addEventListener(FormEvents::PRE_SUBMIT, array($mock, 'preSubmit'));
     $form = new Form($config);
     // no call to setData() or similar where the object would be
     // initialized otherwise
     $form->submit('foobar');
 }
开发者ID:NivalM,项目名称:VacantesJannaMotors,代码行数:13,代码来源:SimpleFormTest.php


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