繁体   English   中英

symfony2tetranz select2entity-bundle

[英]symfony2 tetranz select2entity-bundle

我目前正在使用select2 v4,因为这现在需要一个select而不是一个输入,当我通过ajax加载这些选项时,我在验证选项时遇到了问题。

我安装了tetranz / select2entity-bundle( https://github.com/tetranz/select2entity-bundle )。 我一直按照说明进行操作,安装后现在收到此错误消息:

 The option "multiple" does not exist. Known options are: "action", "attr", 
"auto_initialize", "block_name", "by_reference", "cascade_validation", 
"compound", "constraints", "csrf_field_name", "csrf_message", 
"csrf_protection", "csrf_provider", "csrf_token_id", "csrf_token_manager", 
"data", "data_class", "disabled", "empty_data", "error_bubbling", 
"error_mapping", "extra_fields_message", "inherit_data", "intention", 
"invalid_message", "invalid_message_parameters", "label", "label_attr", 
"mapped", "max_length", "method", "pattern", "post_max_size_message", 
"property_path", "read_only", "required", "translation_domain", "trim", 
"validation_groups", "virtual"

500 Internal Server Error - InvalidOptionsException 

除了安装,我的表单生成器-> add看起来像这样:

       ->add('receiver_physician', 'tetranz_select2entity', array(
           'multiple' => false,
           'remote_route' => 'ajax_physician_search_by_term',
           'class' => '\HospitalBundle\Entity\Physician',
           'text_property' => 'name',
           'minimum_input_length' => 2,
           'page_limit' => 10,
           'placeholder' => 'Select a Physician',
       ))

其他人有这个问题吗?

与tetranz_select2entity关联的类具有configureOptions()方法。 它是在Symfony 2.7中引入的。 以前,该方法称为setDefaultOptions()。

作为一个空白,我在Select2EntityType中添加了以下内容:

/**
 * @param OptionsResolverInterface $resolver
 */
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
    $this->configureOptions($resolver);
}

(也需要“ use”声明。对作者的贡献如下。)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM