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


PHP OptionsResolverInterface::addAllowedTypes方法代码示例

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


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

示例1: 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

示例2: setDefaultSettings

 /**
  * @param OptionsResolverInterface $optionsResolver
  * @param BlockInterface           $block
  */
 protected function setDefaultSettings(OptionsResolverInterface $optionsResolver, BlockInterface $block)
 {
     // defaults for all blocks
     $optionsResolver->setDefaults(array('use_cache' => true, 'extra_cache_keys' => array(), 'attr' => array(), 'template' => false, 'ttl' => (int) $block->getTtl()));
     $optionsResolver->addAllowedTypes(array('use_cache' => array('bool'), 'extra_cache_keys' => array('array'), 'attr' => array('array'), 'ttl' => array('int'), 'template' => array('string', 'bool')));
     // add type and class settings for block
     $class = ClassUtils::getClass($block);
     $settingsByType = isset($this->settingsByType[$block->getType()]) ? $this->settingsByType[$block->getType()] : array();
     $settingsByClass = isset($this->settingsByClass[$class]) ? $this->settingsByClass[$class] : array();
     $optionsResolver->setDefaults(array_merge($settingsByType, $settingsByClass));
 }
开发者ID:LamaDelRay,项目名称:test_symf,代码行数:15,代码来源:BlockContextManager.php

示例3: setDefaultOptions

 /**
  * {@inheritDoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('disabled_settings' => array()));
     $resolver->addAllowedTypes(array('disabled_settings' => 'array'));
 }
开发者ID:victorhaggqvist,项目名称:SettingsBundle,代码行数:8,代码来源:SettingsType.php

示例4: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('enable' => $this->container->getParameter('bootstrapp.ckeditor.enable'), 'base_path' => $this->container->getParameter('bootstrapp.ckeditor.base_path'), 'config_name' => $this->container->getParameter('bootstrapp.ckeditor.default_config'), 'config' => array(), 'plugins' => array()));
     $resolver->addAllowedTypes(array('enable' => 'bool', 'config_name' => array('string', 'null'), 'base_path' => array('string'), 'config' => 'array', 'plugins' => 'array'));
 }
开发者ID:nmariani,项目名称:bootstrapp-bundle,代码行数:8,代码来源:CKEditorType.php

示例5: setDefaultSettings

    /**
     * {@inheritdoc}
     */
    public function setDefaultSettings(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'template'       => $this->template,
            'divisible_by'    => 0,
            'divisible_class' => '',
            'child_class'     => '',
        ));

        $resolver->addAllowedTypes(array(
            'divisible_by'    => array('integer'),
            'divisible_class' => array('string'),
            'child_class'     => array('string'),
        ));
    }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:18,代码来源:ContainerBlockService.php


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