簡體   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