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


PHP FormInterface::count方法代码示例

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


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

示例1: buildViewRootForm

 /**
  * @test
  */
 public function buildViewRootForm()
 {
     $this->configureFormRoot();
     $this->form->count()->shouldBeCalled()->willReturn(2);
     $extension = $this->createExtension();
     $this->buildView($extension);
     $attributes = $this->view->vars['attr'];
     $this->assertArrayHasKey('novalidate', $attributes);
     $this->assertTrue($attributes['novalidate']);
     $this->assertArrayHasKey('data-parsley-validate', $attributes);
     $this->assertTrue($attributes['data-parsley-validate']);
     $this->assertArrayNotHasKey('data-parsley-trigger', $attributes);
 }
开发者ID:J-Ben87,项目名称:ParsleyBundle,代码行数:16,代码来源:ParsleyTypeExtensionTest.php

示例2: buildView

 /**
  * {@inheritdoc}
  *
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     if ($form->count() == 0) {
         return;
     }
     array_map(array($this, 'validateButton'), $form->all());
 }
开发者ID:pr0coder,项目名称:Inkstand,代码行数:14,代码来源:FormActionsType.php

示例3: getErrorMessages

 /**
  * Returns an array with form fields errors
  *
  * @param FormInterface $form
  * @param bool|false $useLabels
  * @param array $errors
  * @return array
  */
 public function getErrorMessages(FormInterface $form, $useLabels = false, $errors = array())
 {
     if ($form->count() > 0) {
         foreach ($form->all() as $child) {
             if (!$child->isValid()) {
                 $errors = $this->getErrorMessages($child, $useLabels, $errors);
             }
         }
     }
     foreach ($form->getErrors() as $error) {
         if ($useLabels) {
             $fieldNameData = $this->getErrorFormLabel($form);
         } else {
             $fieldNameData = $this->getErrorFormId($form);
         }
         $fieldName = $fieldNameData;
         if ($useLabels) {
             /**
              * @ignore
              */
             $fieldName = $this->translator->trans($fieldNameData['label'], array(), $fieldNameData['domain']);
         }
         $errors[$fieldName] = $error->getMessage();
     }
     return $errors;
 }
开发者ID:auamarto,项目名称:crud-bundle,代码行数:34,代码来源:FormErrorHandler.php

示例4: isExpanded

 protected function isExpanded(FormInterface $form)
 {
     if (0 === $form->count()) {
         return false;
     }
     $innerType = $form->getConfig()->getType()->getInnerType();
     if (0 === strpos(get_class($innerType), 'Symfony')) {
         return false;
     }
     return true;
 }
开发者ID:HNKSoftware,项目名称:FrameworkBundle,代码行数:11,代码来源:FormRenderHelper.php

示例5: unbind

 /**
  * Returns the form's data like $form->submit() expects it
  *
  * @param FormInterface $form
  * @return array
  */
 protected function unbind(FormInterface $form)
 {
     if ($form->count() > 0) {
         $ary = array();
         foreach ($form->all() as $name => $child) {
             $value = $this->unbind($child);
             if (null !== $value || (is_array($value) || $value instanceof Collection) && count($value) > 0) {
                 $ary[$name] = $value;
             }
         }
         return $ary;
     } else {
         $data = $form->getViewData();
         return $data instanceof Collection ? $data->toArray() : $data;
     }
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:22,代码来源:PatchSubscriber.php

示例6: addChildErrors

 private static function addChildErrors(FormInterface $parent, &$errors, $path = '')
 {
     if ($parent->count() == 0) {
         return;
     }
     foreach ($parent as $child) {
         if ($path == '') {
             $childPath = $child->getName();
         } else {
             $childPath = $path . '.' . $child->getName();
         }
         if ($child->isValid()) {
             continue;
         }
         $childErrors = array();
         foreach ($child->getErrors() as $key => $error) {
             $childErrors[$key] = $error->getMessage();
         }
         if (count($childErrors) > 0) {
             $errors[$childPath] = $childErrors;
         }
         self::addChildErrors($child, $errors, $childPath);
     }
 }
开发者ID:proyecto404,项目名称:UtilBundle,代码行数:24,代码来源:FormUtil.php


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