當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。