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


PHP FormInterface::getChildren方法代码示例

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


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

示例1: buildView

 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $knockout['enabled'] = $form->getAttribute('knockout');
     if ($knockout['enabled'] === true) {
         $knockout['viewModel'] = array('name' => $form->getName(), 'fields' => $this->buildViewModelFields($form->getChildren()), 'bindings' => $this->buildViewModelBindings($form->getChildren()), 'collections' => $this->getCollections($form->getChildren(), $view));
     }
     $view->set('knockout', $knockout);
 }
开发者ID:rjmunro,项目名称:KnockoutJSBundle,代码行数:8,代码来源:KnockoutExtension.php

示例2: getErrorMessages

 public static function getErrorMessages(FormInterface $form)
 {
     $errors = array();
     foreach ($form->getErrors() as $key => $error) {
         $template = $error->getMessageTemplate();
         $parameters = $error->getMessageParameters();
         foreach ($parameters as $var => $value) {
             $template = str_replace($var, $value, $template);
         }
         $errors[$key] = $template;
     }
     if ($form->hasChildren()) {
         foreach ($form->getChildren() as $child) {
             if (!$child->isValid()) {
                 $errors[$child->getName()] = self::getErrorMessages($child);
             }
         }
     }
     return $errors;
 }
开发者ID:nutrija,项目名称:dsl-symfony,代码行数:20,代码来源:FormHelper.php

示例3: buildNamePathMapping

 private function buildNamePathMapping(FormInterface $form, array &$forms, $namePath = '')
 {
     $iterator = new VirtualFormAwareIterator($form->getChildren());
     $iterator = new \RecursiveIteratorIterator($iterator);
     foreach ($iterator as $child) {
         $nestedNamePath = $namePath . '.' . $child->getName();
         $forms[$nestedNamePath] = $child;
         if ($child->hasChildren()) {
             $this->buildNamePathMapping($child, $forms, $nestedNamePath);
         }
     }
 }
开发者ID:laiello,项目名称:mediathequescrum,代码行数:12,代码来源:DelegatingValidator.php

示例4: getErrorsAsString

 /** End Garantie Entity **/
 protected function getErrorsAsString($fields, $class, $admin, \Symfony\Component\Form\FormInterface $form, $line, $level = 0, $field = '', $message = null)
 {
     $errors = array();
     if ($form->getErrors()) {
         $one_view = array();
         foreach ($form->getErrors() as $keys => $error) {
             if (!isset($one_view[$field][$line])) {
                 $one_view[$field][$line] = true;
                 $repeat = str_repeat(' ', $level);
                 $label = isset($fields[$field]) ? '(' . (\PHPExcel_Cell::stringFromColumnIndex($fields[$field]) . ':' . $line) . ') ' : '';
                 $data = $form->getViewData();
                 if (is_array($data)) {
                     $data = implode('-', $data);
                 }
                 if ($error->getMessageParameters()) {
                     $data = implode($error->getMessageParameters());
                 }
                 $errors[] = $repeat . 'VALUE : ' . $label . ($data ?: 'empty') . "\n";
                 $errors[] = $repeat . 'ERROR : ' . $error->getMessage() . "\n\n";
             }
         }
     }
     foreach ($form->getChildren() as $field => $child) {
         if ($field == 'client') {
             continue;
         }
         if ($err = $this->getErrorsAsString($fields, $class, $admin, $child, $line, $level + 4, $field, null)) {
             $errors[] = $admin->trans('form.' . $class . '.' . $field) . "\n";
             $errors[] = $err;
         }
     }
     if (!empty($message)) {
         $errors[] = $message;
     }
     return implode($errors);
 }
开发者ID:defan-marunchak,项目名称:eurotax,代码行数:37,代码来源:ImportClientCommand.php


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