本文整理匯總了PHP中Symfony\Component\OptionsResolver\OptionsResolverInterface::addAllowedValues方法的典型用法代碼示例。如果您正苦於以下問題:PHP OptionsResolverInterface::addAllowedValues方法的具體用法?PHP OptionsResolverInterface::addAllowedValues怎麽用?PHP OptionsResolverInterface::addAllowedValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\OptionsResolver\OptionsResolverInterface
的用法示例。
在下文中一共展示了OptionsResolverInterface::addAllowedValues方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
set_error_handler(array('Symfony\\Component\\Form\\Test\\DeprecationErrorHandler', 'handleBC'));
$resolver->setDefaults($this->getDefaultOptions(array()));
$resolver->addAllowedValues($this->getAllowedOptionValues(array()));
restore_error_handler();
}
示例2: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$defaults = $this->getDefaultOptions(array());
$allowedTypes = $this->getAllowedOptionValues(array());
if (!empty($defaults)) {
trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
$resolver->setDefaults($defaults);
}
if (!empty($allowedTypes)) {
trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
$resolver->addAllowedValues($allowedTypes);
}
}
示例3: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults($this->getDefaultOptions());
$resolver->addAllowedValues($this->getAllowedOptionValues());
}
示例4: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array('required' => false, 'config_name' => 'boxit_default', 'config' => array()));
$resolver->addAllowedValues(array('required' => array(false)));
}
示例5: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array('model_manager' => null, 'class' => null, 'required' => false, 'provider_name' => false, 'context' => false, 'admin_code' => 'sonata.media.admin.media', 'error_bubbling' => false, 'compound' => false));
$resolver->setRequired(array('class'));
$resolver->addAllowedValues(array('required' => array(false)));
}
示例6: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array('password_required' => false, 'data_class' => 'Kunstmaan\\AdminBundle\\Entity\\User'));
$resolver->addAllowedValues(array('password_required' => array(true, false)));
}