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


PHP OptionsResolver::setRequired方法代码示例

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


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

示例1: __construct

 /**
  * @param string $themeClassName
  * @param PropertyAccessorInterface $propertyAccessor
  */
 public function __construct($themeClassName, PropertyAccessorInterface $propertyAccessor)
 {
     $this->themeClassName = $themeClassName;
     $this->propertyAccessor = $propertyAccessor;
     $this->optionsResolver = new OptionsResolver();
     $this->optionsResolver->setRequired(['name', 'slug'])->setDefined('description')->setDefault('parents', [])->setAllowedTypes('parents', 'array');
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:11,代码来源:ThemeFactory.php

示例2: configureWeekMealOptions

 /**
  * Set up the configurations of options
  * passed as argument into the following methods of this class :
  * - getWeekDates
  * - getWeekMeals
  */
 private function configureWeekMealOptions()
 {
     $this->weekMealResolver->setDefined(array('date_day', 'without_pork', 'enable_next_week', 'days_ofweek_off', 'dates_off'));
     $this->weekMealResolver->setAllowedTypes('date_day', \DateTimeInterface::class);
     $this->weekMealResolver->setDefaults(array('without_pork' => false, 'enable_next_week' => false, 'days_ofweek_off' => array(Day::WEEK_WEDNESDAY), 'dates_off' => array()));
     $this->weekMealResolver->setRequired(array('without_pork', 'date_day'));
 }
开发者ID:WildCodeSchool,项目名称:projet-gesty,代码行数:13,代码来源:LunchRepository.php

示例3: __construct

 /**
  * ActivityRepositoryAbstract constructor.
  *
  * @inheritdoc
  */
 public function __construct($em, \Doctrine\ORM\Mapping\ClassMetadata $class)
 {
     $this->dayListResolver = new OptionsResolver();
     $this->dayListResolver->setRequired(array('date_day', 'school'));
     $this->configureDayListOptions($this->dayListResolver);
     parent::__construct($em, $class);
 }
开发者ID:WildCodeSchool,项目名称:projet-gesty,代码行数:12,代码来源:ActivityRepositoryAbstract.php

示例4: configureOptions

 protected function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired("type");
     $resolver->setRequired("name");
     $resolver->setAllowedValues('type', ['url', 'image', 'text', 'page_select', 'product_category_select', 'product_select', 'collection_select']);
     $resolver->setDefaults(array('type' => 'text', 'options' => 'options'));
 }
开发者ID:pasls,项目名称:tdk,代码行数:7,代码来源:ConfigManager.php

示例5: configureOptions

 /**
  * Configure adapter options
  *
  * @param  OptionsResolver $resolver
  * @throws \Symfony\Component\OptionsResolver\Exception\AccessException
  * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired('username')->setAllowedTypes('username', ['string']);
     $resolver->setRequired('password')->setAllowedTypes('password', ['string']);
     $resolver->setRequired('roles')->setAllowedTypes('roles', ['array']);
     $resolver->setDefined('salt')->setAllowedTypes('salt', ['string', 'null']);
 }
开发者ID:sunnyct,项目名称:silexcmf,代码行数:14,代码来源:InMemoryProvider.php

示例6: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired(array('relative_path'));
     $resolver->setRequired(array('imagine_filter'));
     $resolver->setDefaults(array('class' => '', 'padding' => '', 'name' => '', 'orderable' => false, 'searchable' => false, 'title' => '', 'type' => '', 'visible' => true, 'width' => '', 'search_type' => 'like', 'filter_type' => 'text', 'filter_options' => array(), 'filter_property' => '', 'filter_search_column' => '', 'holder_url' => '', 'holder_width' => '50', 'holder_height' => '50', 'enlarge' => false));
     $resolver->setAllowedTypes('class', 'string');
     $resolver->setAllowedTypes('padding', 'string');
     $resolver->setAllowedTypes('name', 'string');
     $resolver->setAllowedTypes('orderable', 'bool');
     $resolver->setAllowedTypes('searchable', 'bool');
     $resolver->setAllowedTypes('title', 'string');
     $resolver->setAllowedTypes('type', 'string');
     $resolver->setAllowedTypes('visible', 'bool');
     $resolver->setAllowedTypes('width', 'string');
     $resolver->setAllowedTypes('search_type', 'string');
     $resolver->setAllowedTypes('filter_type', 'string');
     $resolver->setAllowedTypes('filter_options', 'array');
     $resolver->setAllowedTypes('filter_property', 'string');
     $resolver->setAllowedTypes('filter_search_column', 'string');
     $resolver->setAllowedTypes('imagine_filter', 'string');
     $resolver->setAllowedTypes('relative_path', 'string');
     $resolver->setAllowedTypes('holder_url', 'string');
     $resolver->setAllowedTypes('holder_width', 'string');
     $resolver->setAllowedTypes('holder_height', 'string');
     $resolver->setAllowedTypes('enlarge', 'bool');
     $resolver->setAllowedValues('search_type', array('like', 'notLike', 'eq', 'neq', 'lt', 'lte', 'gt', 'gte', 'in', 'notIn', 'isNull', 'isNotNull'));
     $resolver->setAllowedValues('filter_type', array('text', 'select'));
     return $this;
 }
开发者ID:bigz,项目名称:datatablesbundle,代码行数:32,代码来源:GalleryColumn.php

示例7: __construct

 public function __construct(TokenRetrieveHelper $helper, array $config = [])
 {
     $this->config = $config;
     $this->helper = $helper;
     $this->optionsResolver = new OptionsResolver();
     $this->optionsResolver->setRequired(['client_id', 'client_secret', 'grant_type']);
     $this->optionsResolver->setDefault('grant_type', $this->getGrantType());
 }
开发者ID:tomhaj,项目名称:guzzle-oauth2,代码行数:8,代码来源:AbstractGrantType.php

示例8: __construct

 /**
  * Instanciate the base filter
  *
  * @param AttributeValidatorHelper       $attrValidatorHelper
  * @param ConfigurationRegistryInterface $registry
  * @param ReferenceDataIdResolver        $idsResolver
  * @param array                          $supportedOperators
  */
 public function __construct(AttributeValidatorHelper $attrValidatorHelper, ConfigurationRegistryInterface $registry, ReferenceDataIdResolver $idsResolver, array $supportedOperators = [])
 {
     $this->attrValidatorHelper = $attrValidatorHelper;
     $this->registry = $registry;
     $this->idsResolver = $idsResolver;
     $this->supportedOperators = $supportedOperators;
     $this->optionsResolver = new OptionsResolver();
     $this->optionsResolver->setRequired(['field'])->setDefined(['locale', 'scope']);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:17,代码来源:ReferenceDataFilter.php

示例9: configureOptions

 /**
  * Configure adapter options
  *
  * @param  OptionsResolver $resolver
  * @throws \Symfony\Component\OptionsResolver\Exception\AccessException
  * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired('table_name')->setAllowedTypes('table_name', ['string']);
     $resolver->setRequired('identity_column')->setAllowedTypes('identity_column', ['string']);
     $resolver->setRequired('credential_column')->setAllowedTypes('credential_column', ['string']);
     $resolver->setDefined('roles_column')->setAllowedTypes('roles_column', ['string', 'null']);
     $resolver->setDefined('salt_column')->setAllowedTypes('salt_column', ['string', 'null']);
     $resolver->setDefault('use_ambiguity_identity', false)->setAllowedTypes('use_ambiguity_identity', ['bool']);
 }
开发者ID:sunnyct,项目名称:silexcmf,代码行数:16,代码来源:DatabaseProvider.php

示例10: __construct

 /**
  * @param array $params
  * @param ApplicationPaths $appPaths
  * @param ActiveTheme $theme
  * @param RequestStack $requestStack
  * @param string $env
  */
 public function __construct(array $params, ApplicationPaths $appPaths, ActiveTheme $theme, RequestStack $requestStack, $env)
 {
     $this->params = $params;
     $this->appPaths = $appPaths;
     $this->theme = $theme;
     $this->request = $requestStack;
     $this->env = $env;
     $this->resolver = new OptionsResolver();
     $this->resolver->setRequired('resources');
     $this->resolver->setRequired('translations');
     $this->resolver->setAllowedTypes('resources', ['array']);
     $this->resolver->setAllowedTypes('translations', ['array']);
 }
开发者ID:mikoweb,项目名称:vsymfo-core-bundle,代码行数:20,代码来源:WebuiService.php

示例11: configurePayload

 /**
  * @inheritdoc
  */
 public function configurePayload(OptionsResolver $resolver)
 {
     $resolver->setRequired(0);
     $resolver->setAllowedTypes(0, 'numeric');
     $resolver->setNormalizer(0, function (Options $options, $value) {
         if (null === ($scraper = $this->findScraper($value))) {
             throw new InvalidArgumentException(sprintf('Could not find scraper with id %d', $value));
         }
         return $scraper;
     });
     $resolver->setRequired(1);
     $resolver->setAllowedTypes(1, 'string');
 }
开发者ID:treehouselabs,项目名称:io-bundle,代码行数:16,代码来源:ScrapeUrlExecutor.php

示例12: __construct

 public function __construct()
 {
     $this->allowedTypes = array_merge(array('driver' => array('string'), 'options' => array('array', 'null'), 'attributes' => array('array')), $this->allowedTypes);
     $this->allowedValues = array_merge(array('driver' => array($this->driver)), $this->allowedValues);
     $this->defaults = array_merge(array('driver' => $this->driver, 'options' => array(), 'attributes' => array()), $this->defaults);
     $this->resolver = new OptionsResolver();
     $this->resolver->setRequired($this->required)->setDefaults($this->defaults);
     foreach ($this->allowedValues as $option => $value) {
         $this->resolver->setAllowedValues($option, $value);
     }
     foreach ($this->allowedTypes as $option => $value) {
         $this->resolver->setAllowedTypes($option, $value);
     }
 }
开发者ID:0mcandal0,项目名称:PdoServiceProvider,代码行数:14,代码来源:PdoConfig.php

示例13: setOptions

 /**
  * @param array $options
  */
 public function setOptions($options = array())
 {
     $resolver = new OptionsResolver();
     $resolver->setDefaults(array());
     $resolver->setRequired('slider_id');
     $resolver->setAllowedTypes('slider_id', 'string');
     $resolver->setRequired('start');
     $resolver->setAllowedTypes('start', 'array');
     $resolver->setRequired('range_min');
     $resolver->setAllowedTypes('range_min', 'numeric');
     $resolver->setRequired('range_max');
     $resolver->setAllowedTypes('range_max', 'numeric');
     $resolver->setDefined('range_steps');
     $resolver->setAllowedTypes('range_steps', 'array');
     $resolver->setDefined('step');
     $resolver->setAllowedTypes('step', 'numeric');
     $resolver->setDefined('connect');
     $resolver->setAllowedTypes('connect', 'string');
     $resolver->setAllowedValues('connect', array('lower', 'upper', 'true', 'false'));
     $resolver->setDefault('connect', 'false');
     $resolver->setDefined('margin');
     $resolver->setAllowedTypes('margin', 'numeric');
     $resolver->setDefined('limit');
     $resolver->setAllowedTypes('margin', 'numeric');
     $resolver->setDefined('orientation');
     $resolver->setAllowedTypes('orientation', 'string');
     $resolver->setAllowedValues('orientation', array('vertical', 'horizontal'));
     $resolver->setDefault('orientation', 'horizontal');
     $resolver->setDefined('slider_dimension');
     $resolver->setAllowedTypes('slider_dimension', 'array');
     $resolver->setDefined('direction');
     $resolver->setAllowedTypes('direction', 'string');
     $resolver->setAllowedValues('direction', array('ltr', 'rtl'));
     $resolver->setDefault('direction', 'ltr');
     $resolver->setDefined('animate');
     $resolver->setAllowedTypes('animate', 'boolean');
     $resolver->setDefault('animate', true);
     $resolver->setDefined('animation_duration');
     $resolver->setAllowedTypes('animation_duration', 'numeric');
     $resolver->setDefined('tooltips');
     $resolver->setAllowedTypes('tooltips', 'array');
     //events
     $resolver->setDefined('update_event');
     $resolver->setDefined('change_event');
     $resolver->setDefined('set_event');
     $resolver->setDefined('slide_event');
     $resolver->setDefined('start_event');
     $resolver->setDefined('end_event');
     $this->options = $resolver->resolve($options);
 }
开发者ID:silviomessi,项目名称:sliderbundle,代码行数:53,代码来源:Slider.php

示例14: configurePayload

 /**
  * @inheritdoc
  */
 public function configurePayload(OptionsResolver $resolver)
 {
     $resolver->setRequired(0);
     $resolver->setRequired(1);
     $resolver->setAllowedTypes(0, 'string');
     $resolver->setAllowedTypes(1, 'array');
     $resolver->setNormalizer(1, function (Options $options, $value) {
         $class = $options[0];
         if (null === ($item = $this->doctrine->getRepository($class)->findOneBy($value))) {
             throw new InvalidArgumentException(sprintf('Could not find %s with id %d', $class, $value));
         }
         return $item;
     });
 }
开发者ID:treehouselabs,项目名称:io-bundle,代码行数:17,代码来源:ItemExportExecutor.php

示例15: configureOptions

 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefined(['customFormModel', 'territoryRepository', 'projectSettings']);
     $resolver->setRequired(['customFormModel', 'territoryRepository', 'projectSettings']);
     $resolver->addAllowedTypes('customFormModel', CustomFormModelInterface::class);
     $resolver->addAllowedTypes('projectSettings', ProjectSettings::class);
 }
开发者ID:zyxist,项目名称:cantiga,代码行数:7,代码来源:AreaProfileForm.php


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