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


PHP FormEvent::getName方法代码示例

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


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

示例1: setData

 public function setData($data)
 {
     if ($this->event->getName() == FormEvents::PRE_SUBMIT) {
         $this->event->setData($data);
     } else {
         trigger_error(__CLASS__ . "::" . __FUNCTION__ . " can only be called in BoltFormsEvents::PRE_SUBMIT", E_USER_ERROR);
     }
 }
开发者ID:rossriley,项目名称:bolt-extension-boltforms,代码行数:8,代码来源:BoltFormsEvent.php

示例2: setData

 public function setData($data)
 {
     if ($this->event->getName() === FormEvents::PRE_SUBMIT) {
         $this->event->setData($data);
     } else {
         throw new \RuntimeException(__CLASS__ . '::' . __FUNCTION__ . ' can only be called in BoltFormsEvents::PRE_SUBMIT');
     }
 }
开发者ID:rudott,项目名称:bolt-extension-boltforms,代码行数:8,代码来源:BoltFormsEvent.php

示例3: preSubmitData

 public function preSubmitData(FormEvent $event)
 {
     $data = $event->getData();
     if (!$data) {
         $data = $event->getForm()->getParent()->getData();
     }
     $form = $event->getForm();
     $targetEntity = null;
     if (isset($data['target_entity'])) {
         $targetEntity = $data['target_entity'];
     }
     $relationType = $this->config->getId()->getFieldType();
     if ($relationType == 'manyToOne') {
         //target_field
         $targetField = null;
         if (isset($data['target_field'])) {
             $targetField = $data['target_field'];
         }
         $form->add($this->formFactory->createNamed('target_field', new TargetFieldType($this->configProvider, $targetEntity), $targetField));
     } else {
         //target_grid
         $targetGrid = null;
         if (isset($data['target_grid'])) {
             $targetGrid = $data['target_grid'];
         }
         $form->add($this->formFactory->createNamed('target_grid', new TargetFieldType($this->configProvider, $targetEntity), $targetGrid, ['multiple' => true, 'label' => 'Related entity data fields']));
         //target_title
         $targetTitle = null;
         if (isset($data['target_title'])) {
             $targetTitle = $data['target_title'];
         }
         $form->add($this->formFactory->createNamed('target_title', new TargetFieldType($this->configProvider, $targetEntity), $targetTitle, ['multiple' => true, 'label' => 'Related entity info title']));
         //target_detailed
         $targetDetailed = null;
         if (isset($data['target_detailed'])) {
             $targetDetailed = $data['target_detailed'];
         }
         $form->add($this->formFactory->createNamed('target_detailed', new TargetFieldType($this->configProvider, $targetEntity), $targetDetailed, ['multiple' => true, 'label' => 'Related entity detailed']));
     }
     if ($event->getName() == FormEvents::PRE_SUBMIT) {
         $event->getForm()->getParent()->setData(array_merge($event->getForm()->getParent()->getData(), $data));
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:43,代码来源:RelationType.php

示例4: preSubmitData

 public function preSubmitData(FormEvent $event)
 {
     $form = $event->getForm();
     $data = $event->getData();
     if (!$data) {
         $data = $form->getParent()->getData();
     }
     if ($this->config->get('owner') === ExtendScope::OWNER_CUSTOM) {
         $targetEntity = $this->getArrayValue($data, 'target_entity');
         $relationType = $this->config->getId()->getFieldType();
         if ($relationType == 'manyToOne') {
             $this->addTargetField($form, 'target_field', $targetEntity, $this->getArrayValue($data, 'target_field'));
         } else {
             $this->addTargetField($form, 'target_grid', $targetEntity, $this->getArrayValue($data, 'target_grid'), 'Related entity data fields', true);
             $this->addTargetField($form, 'target_title', $targetEntity, $this->getArrayValue($data, 'target_title'), 'Related entity info title', true);
             $this->addTargetField($form, 'target_detailed', $targetEntity, $this->getArrayValue($data, 'target_detailed'), 'Related entity detailed', true);
         }
     }
     if ($event->getName() == FormEvents::PRE_SUBMIT) {
         $form->getParent()->setData(array_merge($form->getParent()->getData(), $data));
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:22,代码来源:RelationType.php


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