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


PHP OptionsResolverInterface::setAllowedValues方法代码示例

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


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

示例1: setOptions

 /**
  * {@inheritDoc}
  */
 public function setOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['forced', 'origin', 'feed', 'date_locale', 'number_locale', 'default_values']);
     $resolver->setAllowedValues(['date_locale' => ['en', 'nl'], 'number_locale' => ['en', 'nl']]);
     $resolver->setAllowedTypes(['forced' => 'bool', 'origin' => 'FM\\IoBundle\\Model\\OriginInterface', 'feed' => 'FM\\IoBundle\\Entity\\Feed', 'default_values' => 'array']);
     $resolver->setDefaults(['forced' => false, 'date_locale' => 'en', 'number_locale' => 'en', 'default_values' => []]);
 }
开发者ID:mvanduijker,项目名称:FMIoBundle,代码行数:10,代码来源:AbstractFeedType.php

示例2: setDefaultOptions

 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('encoding' => 'ascii', 'module' => 5, 'symbol-size' => 'square-auto', 'format' => 'png', 'message-separator' => ' ', 'process-timeout' => 600, 'command' => 'dmtxwrite'));
     $resolver->setOptional(array('resolution', 'margin'));
     $resolver->setAllowedValues(array('encoding' => array('best', 'fast', 'ascii', 'c40', 'text', 'x12', 'edifact', '8base256'), 'format' => array('png', 'tif', 'gif', 'pdf'), 'symbol-size' => array('square-auto', 'rectangle-auto', '10x10', '24x24', '64x64')));
     $resolver->setAllowedTypes(array('resolution' => 'integer', 'module' => 'integer', 'margin' => 'integer'));
 }
开发者ID:pmaselkowski,项目名称:php-dmtx,代码行数:7,代码来源:Writer.php

示例3: setDefaultOptions

 /**
  * Sets the default options for this type.
  *
  * @param OptionsResolverInterface $resolver The resolver for the options.
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('action' => null, 'bundles' => array(), 'domains' => array(), 'locales' => array(), 'files' => array(), 'result' => array(), 'translation_domain' => 'DavamigoTranslatorBundle'));
     $resolver->setRequired(array('action', 'step'));
     $resolver->setAllowedTypes(array('action' => 'string', 'step' => 'int', 'bundles' => 'array', 'domains' => 'array', 'locales' => 'array', 'files' => 'array', 'result' => 'array'));
     $resolver->setAllowedValues(array('step' => array(1, 2, 3)));
 }
开发者ID:davamigo,项目名称:translator-bundle,代码行数:12,代码来源:SaveForm.php

示例4: setDefaultOptions

 /**
  * (non-PHPdoc)
  * @see Symfony\Component\Form.AbstractType::setDefaultOptions()
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $defaultConfigs = array('showOn' => 'button', 'dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm', 'showSecond' => false);
     $resolver->setDefaults(array('input' => 'datetime', 'with_seconds' => false, 'use_meridiem' => false, 'date_timezone' => null, 'user_timezone' => null, 'datetime_format' => 'Y-m-d H:i', 'parts' => array('year', 'month', 'day', 'hour', 'minute'), 'translation_domain' => 'NeutronFormBundle', 'configs' => $defaultConfigs));
     $resolver->setNormalizers(array('datetime_format' => function (Options $options, $value) {
         if ($options->has('with_seconds') && $options->get('with_seconds') === true) {
             return $options->get('use_meridiem') === true ? 'Y-m-d h:i:s a' : 'Y-m-d H:i:s';
         }
         return $options->get('use_meridiem') === true ? 'Y-m-d h:i a' : 'Y-m-d H:i';
     }, 'parts' => function (Options $options, $value) {
         if ($options->has('with_seconds') && $options->get('with_seconds') === true) {
             return array('year', 'month', 'day', 'hour', 'minute', 'second');
         }
         return array('year', 'month', 'day', 'hour', 'minute');
     }, 'configs' => function (Options $options, $value) use($defaultConfigs) {
         $configs = array_replace_recursive($defaultConfigs, $value);
         if (!$options->has('with_seconds') || $options->get('with_seconds') === false) {
             $configs['timeFormat'] = $options->get('use_meridiem') === true ? 'hh:mm tt' : 'HH:mm';
             $configs['showSecond'] = false;
         } else {
             $configs['timeFormat'] = $options->get('use_meridiem') === true ? 'hh:mm:ss tt' : 'HH:mm:ss';
             $configs['showSecond'] = true;
         }
         return $configs;
     }));
     $resolver->setAllowedValues(array('input' => array('datetime', 'string', 'timestamp', 'array'), 'datetime_format' => array('Y-m-d H:i:s', 'Y-m-d h:i:s a', 'Y-m-d H:i', 'Y-m-d h:i a')));
 }
开发者ID:firano,项目名称:form-bundle,代码行数:31,代码来源:DateTimePickerType.php

示例5: setDefaultOptions

 /**
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['type']);
     $resolver->addAllowedTypes(['type' => ['string']]);
     $resolver->setAllowedValues(['type' => Participant::getAllTypes()]);
     $resolver->setDefaults(['data_class' => Participant::class]);
 }
开发者ID:sescandell,项目名称:SymfonyTipsSamples,代码行数:10,代码来源:ParticipantEdit.php

示例6: setDefaultOptions

 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('unicode' => true, 'milliseconds' => 200, 'symbol-size' => 'square-auto', 'process-timeout' => 600, 'command' => 'dmtxread'));
     $resolver->setOptional(array('newline', 'unicode', 'milliseconds', 'codewords', 'minimum-edge', 'maximum-edge', 'gap', 'page', 'square-deviation', 'resolution', 'symbol-size', 'threshold', 'x-range-min', 'x-range-max', 'y-range-min', 'y-range-max', 'corrections-max', 'diagnose', 'mosaic', 'stop-after', 'page-numbers', 'corners', 'shrink'));
     $resolver->setAllowedValues(array('symbol-size' => array('square-auto', 'rectangle-auto', '10x10', '24x24', '64x64')));
     $resolver->setAllowedTypes(array('newline' => 'bool', 'unicode' => 'bool', 'milliseconds' => 'integer', 'codewords' => 'bool', 'minimum-edge' => 'integer', 'maximum-edge' => 'integer', 'gap' => 'integer', 'page' => 'integer', 'square-deviation' => 'integer', 'resolution' => 'integer', 'threshold' => 'integer', 'corrections-max' => 'integer', 'diagnose' => 'bool', 'mosaic' => 'bool', 'stop-after' => 'integer', 'page-numbers' => 'bool', 'corners' => 'bool', 'shrink' => 'integer'));
 }
开发者ID:pmaselkowski,项目名称:php-dmtx,代码行数:7,代码来源:Reader.php

示例7: setDefaultOptions

 /**
  * @inheritdoc
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('reference_currency', 'currency_choices'));
     $resolver->setDefaults(array('reference_currency' => $this->referenceCurrencyCode, 'currency_choices' => $this->currencyCodeList));
     $resolver->setAllowedTypes(array('reference_currency' => array('string'), 'currency_choices' => array('array')));
     $resolver->setAllowedValues(array('reference_currency' => $this->currencyCodeList));
 }
开发者ID:stalxed,项目名称:TbbcMoneyBundle,代码行数:10,代码来源:CurrencyType.php

示例8: setDefaultOptions

 /**
  * Sets the configuration for the options resolver
  * @param OptionsResolverInterface $resolver
  */
 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('directory'));
     $resolver->setDefaults(array('mode' => self::MODE_DIRECTORY_AS_CATEGORY, 'include' => array(), 'limit' => null));
     $resolver->setAllowedValues(array('mode' => array(self::MODE_DOCUMENT_AS_CATEGORY, self::MODE_DIRECTORY_AS_CATEGORY)));
     $resolver->setAllowedTypes(array('directory' => 'string', 'mode' => 'int', 'include' => 'array'));
 }
开发者ID:camspiers,项目名称:statistical-classifier,代码行数:11,代码来源:Directory.php

示例9: configureAttributes

 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['tip', 'direction']);
     $resolver->setDefaults(['direction' => self::DOWN]);
     $resolver->setOptional(['name', 'short_tip', 'retractable', 'default_state', 'property_path', 'transformer']);
     $resolver->setDefaults(['name' => '', 'transformer' => null, 'property_path' => null, 'retractable' => function (Options $options) {
         return isset($options['short_tip']) && strlen($options['short_tip']);
     }]);
     $resolver->setAllowedValues(array('direction' => [self::UP, self::DOWN], 'default_state' => [self::EXPANDED, self::RETRACTED]));
     $resolver->setAllowedTypes(['tip' => 'string', 'direction' => 'string', 'short_tip' => 'string', 'retractable' => 'bool', 'default_state' => 'string']);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:14,代码来源:Tip.php

示例10: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('filters' => array()));
     $resolver->setAllowedTypes(array('filters' => array('array')));
     $resolver->setAllowedValues(array('filters' => function ($filters) {
         foreach ($filters as $key => $value) {
             if (!array_key_exists('field', $value) || !array_key_exists('label', $value) || !array_key_exists('filter', $value) || !array_key_exists('form', $value) || !array_key_exists('options', $value) || $key !== $value['field']) {
                 return false;
             }
         }
         return true;
     }));
 }
开发者ID:kmehmety,项目名称:GeneratorBundle,代码行数:13,代码来源:FilterItemType.php

示例11: setDefaultOptions

 /**
  * (non-PHPdoc)
  * @see Symfony\Component\Form.AbstractType::setDefaultOptions()
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $defaultConfigs = array('showOn' => 'button');
     $resolver->setDefaults(array('input' => 'datetime', 'format' => 'Y-m-d', 'date_timezone' => null, 'user_timezone' => null, 'translation_domain' => 'NeutronFormBundle', 'configs' => $defaultConfigs));
     $resolver->setNormalizers(array('format' => function (Options $options, $value) {
         return 'Y-m-d';
     }, 'configs' => function (Options $options, $value) use($defaultConfigs) {
         $configs = array_replace_recursive($defaultConfigs, $value);
         $configs['dateFormat'] = 'yy-mm-dd';
         return $configs;
     }));
     $resolver->setAllowedValues(array('input' => array('datetime', 'string', 'timestamp', 'array')));
 }
开发者ID:firano,项目名称:form-bundle,代码行数:17,代码来源:DatePickerType.php

示例12: setAllowedValues

 /**
  * Set allowed values
  * 
  * @param OptionsResolverInterface $resolver
  * @return OptionsResolverInterface
  */
 private function setAllowedValues(OptionsResolverInterface $resolver)
 {
     $resolver->setAllowedValues('type', function ($value) {
         return in_array($value, ['single', 'double']);
     });
     //        $resolver->setAllowedValues('values', function($value) {
     //            foreach ($value as $val) {
     //                if (!is_numeric($val)) {
     //                    return false;
     //                }
     //            }
     //            return true;
     //        });
     $resolver->setAllowedValues('step', function ($value) {
         return $value > 0;
     });
 }
开发者ID:TMSolution,项目名称:FormTypeBundle,代码行数:23,代码来源:ValueSliderType.php

示例13: setDefaultOptions

 /**
  * (non-PHPdoc)
  * @see Symfony\Component\Form.AbstractType::setDefaultOptions()
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $choiceList = new AjaxChoiceList(array());
     $resolver->setDefaults(array('first_options' => array(), 'second_options' => array(), 'error_bubbling' => false, 'first_name' => 'first_name', 'second_name' => 'second_name', 'widget' => 'choice', 'translation_domain' => 'NeutronFormBundle', 'multiple' => false, 'choices' => array(), 'configs' => array()));
     $resolver->setNormalizers(array('first_options' => function (Options $options, $value) {
         $value['choices'] = $options->get('choices');
         return $value;
     }, 'second_options' => function (Options $options, $value) use($choiceList) {
         $value['choice_list'] = $choiceList;
         $value['multiple'] = $options->get('multiple');
         return $value;
     }, 'configs' => function (Options $options, $value) {
         $value['first_name'] = $options->get('first_name');
         $value['second_name'] = $options->get('second_name');
         $value['dependent_source'] = $options->get('dependent_source');
         $value['multiple'] = $options->get('multiple');
         return $value;
     }));
     $resolver->setRequired(array('dependent_source'));
     $resolver->setAllowedValues(array('widget' => array('choice')));
     $resolver->setAllowedTypes(array('multiple' => array('bool'), 'choices' => array('array'), 'dependent_source' => array('string')));
 }
开发者ID:firano,项目名称:form-bundle,代码行数:26,代码来源:Select2DependentType.php

示例14: configureOptions

 /**
  * Configure the option resolver
  *
  * @param OptionsResolverInterface $resolver
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('client_id', 'client_secret', 'authorization_url', 'access_token_url', 'infos_url'));
     $resolver->setDefaults(array('scope' => null, 'csrf' => false, 'user_response_class' => 'HWI\\Bundle\\OAuthBundle\\OAuth\\Response\\PathUserResponse', 'auth_with_one_url' => false));
     $resolver->setAllowedValues(array('csrf' => array(true, false)));
 }
开发者ID:senthilkumar3282,项目名称:HWIOAuthBundle,代码行数:11,代码来源:AbstractResourceOwner.php

示例15: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('widget_control_group' => true, 'widget_controls' => true, 'widget_addon' => array('type' => null, 'icon' => null, 'text' => null), 'widget_prefix' => null, 'widget_suffix' => null, 'widget_type' => '', 'widget_items_attr' => array(), 'widget_control_group_attr' => array(), 'widget_controls_attr' => array(), 'widget_checkbox_label' => $this->options['checkbox_label']));
     $resolver->setAllowedValues(array('widget_type' => array('inline', ''), 'widget_checkbox_label' => array('label', 'widget', 'both')));
 }
开发者ID:pigroupe,项目名称:SfynxTemplateBundle,代码行数:5,代码来源:WidgetFormTypeExtension.php


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