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


PHP OptionsResolverInterface::setAllowedTypes方法代码示例

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


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

示例1: __construct

 /**
  * @param EventDispatcherInterface $dispatcher
  */
 public function __construct(EventDispatcherInterface $dispatcher)
 {
     $this->dispatcher   = $dispatcher;
     $this->specResolver = new OptionsResolver;
     $this->specResolver->setDefaults(
         array(
             'on'           => self::ALL,
             'from'         => self::ALL,
             'to'           => self::ALL,
             'exclude_from' => array(),
             'exclude_to'   => array(),
         )
     );
     $this->specResolver->setAllowedTypes(
         array(
             'on'           => array('string', 'array'),
             'from'         => array('string', 'array'),
             'to'           => array('string', 'array'),
             'exclude_from' => array('string', 'array'),
             'exclude_to'   => array('string', 'array'),
         )
     );
     $toArrayNormalizer = function (Options $options, $value) {
         return (array)$value;
     };
     $this->specResolver->setNormalizers(
         array(
             'on'           => $toArrayNormalizer,
             'from'         => $toArrayNormalizer,
             'to'           => $toArrayNormalizer,
             'exclude_to'   => $toArrayNormalizer,
             'exclude_from' => $toArrayNormalizer,
         )
     );
 }
开发者ID:Aasit,项目名称:DISCOUNT--SRV-I,代码行数:38,代码来源:CallbackHandler.php

示例2: setDefaultSettings

 /**
  * {@inheritdoc}
  */
 public function setDefaultSettings(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('groups' => false));
     if (version_compare(Kernel::VERSION, '2.6', '<')) {
         $resolver->setAllowedTypes(array('groups' => array('bool', 'array')));
     } else {
         $resolver->setAllowedTypes('groups', array('bool', 'array'));
     }
 }
开发者ID:kwuerl,项目名称:SonataAdminBundle,代码行数:12,代码来源:AdminListBlockService.php

示例3: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('fields'));
     $reflection = new \ReflectionMethod($resolver, 'setAllowedTypes');
     if ($reflection->getNumberOfParameters() === 2) {
         $resolver->setAllowedTypes('fields', 'array');
     } else {
         $resolver->setAllowedTypes(array('fields' => 'array'));
     }
 }
开发者ID:scaytrase,项目名称:symfony-storable-forms,代码行数:10,代码来源:TableRowType.php

示例4: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('label' => false, "container" => null, "field" => null));
     $resolver->setRequired("resource");
     $resolver->setRequired("area");
     $resolver->setRequired("category");
     $resolver->setAllowedTypes('resource', 'Bigfish\\Bundle\\ResourceBundle\\Entity\\Resource');
     $resolver->setAllowedTypes('area', 'Bigfish\\Bundle\\PagekitBundle\\Entity\\Area');
     $resolver->setAllowedTypes('category', 'Bigfish\\Bundle\\EavBundle\\Entity\\Category');
 }
开发者ID:bigfishcmf,项目名称:bigfishcmf,代码行数:10,代码来源:PagekitGridType.php

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

示例6: configureResolver

 /**
  * {@inheritdoc}
  */
 public function configureResolver(OptionsResolverInterface $resolver)
 {
     $patientNormalizer = function (Options $options, $value) {
         static $resource;
         if (!$resource) {
             $resource = $options['patient_resource']->getRepository();
         }
         return $resource->getByMRN($value);
     };
     $codes = $this->getCodes();
     $diagnosisNormalizer = function (Options $options, $value) use($codes) {
         static $resource;
         if (!$resource) {
             $resource = $options['diagnosis_resource']->getRepository();
         }
         if ($patient = $options['patient']) {
             foreach ($patient->getDiagnoses() as $diagnosis) {
                 if (in_array($diagnosis->getCode()->getCode(), $codes)) {
                     return $diagnosis;
                 }
             }
         }
     };
     $dateNormalizer = function (Options $options, $value) {
         return empty($value) ? null : new DateTime($value);
     };
     $resolver->setRequired(array('patient', 'activity_date'));
     $resolver->setOptional(array('diagnosis'));
     $resolver->setAllowedTypes(array('patient' => array('string'), 'diagnosis' => array('Accard\\Component\\Diagnosis\\Model\\DiagnosisInterface', 'null'), 'activity_date' => array('string', 'null')));
     $resolver->setNormalizers(array('patient' => $patientNormalizer, 'diagnosis' => $diagnosisNormalizer, 'activity_date' => $dateNormalizer));
 }
开发者ID:upenn-dag,项目名称:patient-repository,代码行数:34,代码来源:ActivityImporter.php

示例7: configureAttributes

 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name']);
     $resolver->setOptional(['label', 'class', 'repeat_min', 'repeat_max', 'property_path', 'dependencies', 'filters', 'rules']);
     $resolver->setDefaults(['property_path' => null, 'dependencies' => [], 'filters' => [], 'rules' => []]);
     $resolver->setAllowedTypes(['name' => ['int', 'string'], 'label' => 'string', 'class' => 'string', 'repeat_min' => ['int', 'string'], 'repeat_max' => ['int', 'string'], 'dependencies' => 'array']);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:10,代码来源:Fieldset.php

示例8: configureAttributes

 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label', 'prefixes']);
     $resolver->setDefaults(['prefixes' => ['net', 'gross']]);
     $resolver->setOptional(['vat_field', 'comment', 'suffix', 'prefix', 'selector', 'wrap', 'class', 'css_attribute', 'max_length', 'error', 'rules', 'filters', 'dependencies', 'default']);
     $resolver->setAllowedTypes(['name' => 'string', 'label' => 'string', 'comment' => 'string', 'suffix' => 'string', 'prefix' => 'string', 'selector' => 'string', 'wrap' => 'string', 'class' => 'string', 'css_attribute' => 'string', 'max_length' => 'integer', 'error' => 'string', 'filters' => 'array', 'rules' => 'array', 'dependencies' => 'array', 'default' => ['string', 'integer']]);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:10,代码来源:Price.php

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

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

示例11: configureAttributes

 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['text']);
     $resolver->setOptional(['class', 'name']);
     $resolver->setDefaults(['name' => '']);
     $resolver->setAllowedTypes(['text' => 'string', 'class' => 'string']);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:10,代码来源:StaticText.php

示例12: configureAttributes

 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label']);
     $resolver->setOptional(['comment', 'comment', 'repeat_min', 'repeat_max', 'limit', 'error', 'rules', 'filters', 'dependencies', 'main_id', 'visibility_change', 'upload_url', 'session_name', 'session_id', 'file_types', 'file_types_description', 'delete_handler', 'load_handler', 'property_path', 'dependencies', 'filters', 'rules']);
     $resolver->setDefaults(['repeat_min' => 0, 'repeat_max' => ElementInterface::INFINITE, 'limit' => 1000, 'session_name' => session_name(), 'session_id' => session_id(), 'file_types_description' => 'file_types_description', 'file_types' => ['jpg', 'jpeg', 'png', 'gif'], 'property_path' => null, 'dependencies' => [], 'filters' => [], 'rules' => []]);
     $resolver->setAllowedTypes(['file_types_description' => 'string', 'file_types' => 'array']);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:10,代码来源:Image.php

示例13: configureAttributes

 /**
  * Configures Form attributes
  *
  * @param OptionsResolverInterface $resolver
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name']);
     $resolver->setOptional(['class', 'action', 'method', 'tabs', 'property_path', 'dependencies', 'property_path', 'dependencies', 'filters', 'rules']);
     $resolver->setDefaults(['action' => '', 'class' => '', 'method' => self::FORM_METHOD, 'tabs' => self::TABS_VERTICAL, 'property_path' => null, 'dependencies' => [], 'filters' => [], 'rules' => []]);
     $resolver->setAllowedTypes(['class' => 'string', 'action' => 'string', 'method' => 'string', 'tabs' => 'integer']);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:12,代码来源:Form.php

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

示例15: setDefaultOptions

 /**
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setOptional(array('default', 'query_builder', 'choices'));
     $resolver->setAllowedTypes(array('choices' => 'array'));
     $resolver->setRequired(array('create_form_type', 'class', 'property'));
     $resolver->setDefaults(array('multiple' => false, 'to_select_text' => 'Выбрать', 'to_new_text' => 'Создать'));
 }
开发者ID:amaxlab,项目名称:form-bundle,代码行数:10,代码来源:SelectOrAddType.php


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