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


PHP Form::get方法代码示例

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


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

示例1: process

 /**
  * {@inheritdoc}
  */
 public function process(Request $request, $grantType = 'password')
 {
     $account = $this->records->getAccountByEmail($this->submittedForm->get('email')->getData());
     if (!$account) {
         return null;
     }
     $oauth = $this->records->getOauthByGuid($account->getGuid());
     $requestPassword = $this->submittedForm->get('password')->getData();
     if ($this->isValidPassword($oauth, $requestPassword) === false) {
         return null;
     }
     $accessToken = $this->provider->getAccessToken('password', ['guid' => $account->getGuid()]);
     $this->session->addAccessToken('local', $accessToken)->createAuthorisation($account->getGuid());
     $request->query->set('code', Uuid::uuid4()->toString());
     try {
         parent::process($request, $grantType);
         $this->finish($request);
         $this->feedback->info('Login successful.');
     } catch (DisabledAccountException $ex) {
         $this->session->addRedirect($this->urlGenerator->generate('authenticationLogin'));
         if ($this->session->getAuthorisation()) {
             $this->dispatchEvent(MembersEvents::MEMBER_LOGIN_FAILED_ACCOUNT_DISABLED, $this->session->getAuthorisation());
         }
     }
     return $this->session->popRedirect()->getResponse();
 }
开发者ID:bolt,项目名称:Members,代码行数:29,代码来源:Local.php

示例2: preSave

 /**
  * This method is here to make your life better, so overwrite  it
  *
  * @param \Symfony\Component\Form\Form $form the valid form
  * @param \Taskeet\MainBundle\Entity\Event $Event your \Taskeet\MainBundle\Entity\Event object
  */
 public function preSave(\Symfony\Component\Form\Form $form, \Taskeet\MainBundle\Entity\Event $Event)
 {
     if (!$form->get('reminder')->getData() instanceof DateTime && $form->get('reminder')->getData()) {
         $date = clone $form->get('startDate')->getData();
         $date->sub(new DateInterval($form->get('reminder')->getData()));
         $Event->setReminder($date);
     }
 }
开发者ID:jarmas8611,项目名称:proyect,代码行数:14,代码来源:EditController.php

示例3: formIsSubmitted

 /**
  * @param Form $form
  * @param RuleAction $action
  * @return void
  */
 public function formIsSubmitted(Form $form, RuleAction $action)
 {
     $params = $this->getParams($action);
     $category = $form->get('category')->getData();
     $params['category_id'] = $category->getId();
     $action->setRawParams($params);
 }
开发者ID:jaapjansma,项目名称:homefinance,代码行数:12,代码来源:SetCategory.php

示例4: customValid

 private function customValid(Form $form, $type)
 {
     switch ($type) {
         case 'page':
             if ($form->get('link')->isEmpty()) {
                 $form->get('link')->addError(new FormError('Укажите имя для ссылки'));
             }
             break;
         case 'news':
             if ($form->get('title')->isEmpty()) {
                 $form->get('title')->addError(new FormError('Укажите заголовок'));
             }
             if ($form->get('body')->isEmpty()) {
                 $form->get('body')->addError(new FormError('Отсутствует превью'));
             }
             if ($form->get('preview')->isEmpty()) {
                 $form->get('preview')->addError(new FormError('Отсутствует превью'));
             }
             if ($form->get('caption')->isEmpty() && !$form->get('link')->isEmpty()) {
                 $form->get('caption')->addError(new FormError('Укажите источник'));
             }
             if (!$form->get('caption')->isEmpty() && $form->get('link')->isEmpty()) {
                 $form->get('link')->addError(new FormError('Укажите ссылку на источник'));
             }
             break;
         default:
             break;
     }
     if ($form->get('datePublication')->isEmpty()) {
         $form->get('datePublication')->addError(new FormError('Укажите дату публикации'));
     }
 }
开发者ID:andrewSAY,项目名称:WebEngineBundle,代码行数:32,代码来源:ContentController.php

示例5: postSave

 /**
  * This method is here to make your life better, so overwrite  it
  *
  * @param \Symfony\Component\Form\Form $form the valid form
  * @param \Taskeet\MainBundle\Entity\Ticket $Ticket your \Taskeet\MainBundle\Entity\Ticket object
  */
 public function postSave(\Symfony\Component\Form\Form $form, \Taskeet\MainBundle\Entity\Ticket $Ticket)
 {
     $proveedor = $this->container->get('security.acl.provider');
     $idObjeto = ObjectIdentity::fromDomainObject($Ticket);
     //poniendo al usuario logueado como owner
     $this->setPermissions($proveedor, $idObjeto, $this->getUser(), MaskBuilder::MASK_OWNER);
     //si la tarea tiene asignado un empleado se le asigna el perm operator
     if ($assignedTo = $Ticket->getAssignedTo()) {
         $this->setPermissions($proveedor, $idObjeto, $assignedTo, MaskBuilder::MASK_EDIT);
     }
     if ($data = $form->get('repeat')->getData()) {
         $start = clone $form->get('startDate')->getData();
         $end = clone $form->get('dueDate')->getData();
         $ocurrences = $form->get('ocurrences')->getData();
         $interval = new DateInterval($form->get('repeat')->getData());
         $periodo = new \DatePeriod($start, $interval, $ocurrences, \DatePeriod::EXCLUDE_START_DATE);
         $em = $this->getDoctrine()->getManager();
         foreach ($periodo as $key => $fecha) {
             $ticket = clone $Ticket;
             $ticket->setStartDate($fecha);
             $ticket->setDueDate($end->add($interval));
             $ticket->setTitle(sprintf('%s-%s', $Ticket->getTitle(), $key));
             $ticket->setSlug(sprintf('%s-%s', $Ticket->getSlug(), $key));
             $this->saveObject($ticket);
             $idObjeto = ObjectIdentity::fromDomainObject($ticket);
             $this->setPermissions($proveedor, $idObjeto, $this->getUser(), MaskBuilder::MASK_OWNER);
             $this->setPermissions($proveedor, $idObjeto, $ticket->getAssignedTo(), MaskBuilder::MASK_EDIT);
         }
     }
 }
开发者ID:jarmas8611,项目名称:proyect,代码行数:36,代码来源:NewController.php

示例6: getExpiration

 /**
  * Get the expiration time of the ban based on the fields of the form
  *
  * @param  Form          $form The form
  * @return \TimeDate|null
  */
 private function getExpiration($form)
 {
     if ($form->get('automatic_expiration')->getData()) {
         return $form->get('expiration')->getData();
     } else {
         return null;
     }
 }
开发者ID:allejo,项目名称:bzion,代码行数:14,代码来源:BanFormCreator.php

示例7: preSave

 /**
  * This method is here to make your life better, so overwrite  it
  *
  * @param \Symfony\Component\Form\Form $form the valid form
  * @param \Taskeet\MainBundle\Entity\Event $Event your \Taskeet\MainBundle\Entity\Event object
  */
 public function preSave(\Symfony\Component\Form\Form $form, \Taskeet\MainBundle\Entity\Event $Event)
 {
     $Event->setOwner($this->getUser());
     if ($form->get('remind')->getData()) {
         $date = clone $form->get('startDate')->getData();
         $date->sub(new DateInterval($form->get('remind')->getData()));
         $Event->setReminder($date);
     }
 }
开发者ID:jarmas8611,项目名称:proyect,代码行数:15,代码来源:NewController.php

示例8: handleAdminNotesForm

 /**
  * Handle the admin notes form
  * @param  Form   $form   The form
  * @param  Player $player The player in question
  * @param  Player $me     The currently logged in player
  * @return Form   The updated form
  */
 private function handleAdminNotesForm($form, $player, $me)
 {
     $notes = $form->get('notes')->getData();
     if ($form->get('save_and_sign')->isClicked()) {
         $notes .= ' — ' . $me->getUsername() . ' on ' . TimeDate::now()->toRFC2822String();
     }
     $player->setAdminNotes($notes);
     $this->getFlashBag()->add('success', "The admin notes for {$player->getUsername()} have been updated");
     // Reset the form so that the user sees the updated admin notes
     return $this->creator->create();
 }
开发者ID:bchhun,项目名称:bzion,代码行数:18,代码来源:PlayerController.php

示例9: save

 protected function save(Form $form)
 {
     try {
         ShoppingFluxConfigQuery::setToken($form->get("token")->getData());
         ShoppingFluxConfigQuery::setDefaultLangId($form->get("lang_id")->getData());
         ShoppingFluxConfigQuery::setDeliveryModule($form->get("delivery_module_id")->getData());
         ShoppingFluxConfigQuery::setProd($form->get("prod")->getData());
         ShoppingFluxConfigQuery::setEcotaxRule($form->get("ecotax_id")->getData());
     } catch (\Exception $e) {
         return "An error occured during the recording of the values (" . $e->getMessage() . ")";
     }
     return true;
 }
开发者ID:ThomasArnaud,项目名称:ShoppingFlux,代码行数:13,代码来源:SaveExportController.php

示例10: createFilterQuery

 protected function createFilterQuery(Form $form)
 {
     $qb = $this->getProfessionRepository()->createQueryBuilder('p')->select('p', 'pk')->leftJoin('p.professionkind', 'pk');
     if ($form->get('name')->getNormData()) {
         $qb->andWhere('p.name LIKE :name');
         $qb->setParameter('name', '%' . $form->get('name')->getNormData() . '%');
     }
     if ($form->has('sort_field') && $form->get('sort_field')->getNormData()) {
         $qb->orderBy('p.' . $form->get('sort_field')->getNormData(), $form->get('sort_order')->getNormData());
     } else {
         $qb->orderBy('p.id', 'ASC');
     }
     return $qb->getQuery();
 }
开发者ID:MorozovIvan,项目名称:trud,代码行数:14,代码来源:ProfessionController.php

示例11: createFilterQuery

 protected function createFilterQuery(Form $form)
 {
     $qb = $this->getTechnicalexaminationtypeRepository()->createQueryBuilder('tet');
     if ($form->get('name')->getNormData()) {
         $qb->andWhere('tet.name LIKE :name');
         $qb->setParameter('name', '%' . $form->get('name')->getNormData() . '%');
     }
     if ($form->has('sort_field') && $form->get('sort_field')->getNormData()) {
         $qb->orderBy('tet.' . $form->get('sort_field')->getNormData(), $form->get('sort_order')->getNormData());
     } else {
         $qb->orderBy('tet.id', 'ASC');
     }
     return $qb->getQuery();
 }
开发者ID:MorozovIvan,项目名称:trud,代码行数:14,代码来源:TechnicalexaminationtypeController.php

示例12: createFilterQuery

 protected function createFilterQuery(Form $form)
 {
     $qb = $this->getEquipmentRepository()->createQueryBuilder('e')->select('e', 'enterp', 'subd', 'esg')->leftJoin('e.subdivision', 'subd')->leftJoin('subd.enterprise', 'enterp')->leftJoin('e.equipmentsubgroup', 'esg');
     if ($form->get('name')->getNormData()) {
         $qb->andWhere('e.name LIKE :name');
         $qb->setParameter('name', '%' . $form->get('name')->getNormData() . '%');
     }
     if ($form->has('sort_field') && $form->get('sort_field')->getNormData()) {
         $qb->orderBy('e.' . $form->get('sort_field')->getNormData(), $form->get('sort_order')->getNormData());
     } else {
         $qb->orderBy('e.id', 'ASC');
     }
     return $qb->getQuery();
 }
开发者ID:MorozovIvan,项目名称:trud,代码行数:14,代码来源:EquipmentController.php

示例13: createFilterQuery

 protected function createFilterQuery(Form $form)
 {
     $qb = $this->getUserRepository()->createQueryBuilder('u');
     if ($form->get('email')->getNormData()) {
         $qb->andWhere('u.email LIKE :email');
         $qb->setParameter('email', '%' . $form->get('email')->getNormData() . '%');
     }
     if ($form->has('sort_field') && $form->get('sort_field')->getNormData()) {
         $qb->orderBy('u.' . $form->get('sort_field')->getNormData(), $form->get('sort_order')->getNormData());
     } else {
         $qb->orderBy('u.id', 'ASC');
     }
     return $qb->getQuery();
 }
开发者ID:MorozovIvan,项目名称:trud,代码行数:14,代码来源:UserController.php

示例14: createFilterQuery

 protected function createFilterQuery(Form $form)
 {
     $qb = $this->getTraumaRepository()->createQueryBuilder('t')->select('t', 'e', 'enterp')->leftJoin('t.employee', 'e')->leftJoin('e.enterprise', 'enterp');
     if ($form->get('name')->getNormData()) {
         $qb->andWhere('t.name LIKE :name');
         $qb->setParameter('name', '%' . $form->get('name')->getNormData() . '%');
     }
     if ($form->has('sort_field') && $form->get('sort_field')->getNormData()) {
         $qb->orderBy('t.' . $form->get('sort_field')->getNormData(), $form->get('sort_order')->getNormData());
     } else {
         $qb->orderBy('t.id', 'ASC');
     }
     return $qb->getQuery();
 }
开发者ID:MorozovIvan,项目名称:trud,代码行数:14,代码来源:TraumaController.php

示例15: createFilterQuery

 protected function createFilterQuery(Form $form)
 {
     $qb = $this->getEquipmentgroupRepository()->createQueryBuilder('eg');
     if ($form->get('name')->getNormData()) {
         $qb->andWhere('eg.name LIKE :name');
         $qb->setParameter('name', '%' . $form->get('name')->getNormData() . '%');
     }
     if ($form->has('sort_field') && $form->get('sort_field')->getNormData()) {
         $qb->orderBy('eg.' . $form->get('sort_field')->getNormData(), $form->get('sort_order')->getNormData());
     } else {
         $qb->orderBy('eg.id', 'ASC');
     }
     return $qb->getQuery();
 }
开发者ID:MorozovIvan,项目名称:trud,代码行数:14,代码来源:EquipmentgroupController.php


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