我在Symfony 3或SF3中有一个下面有EntityType:class
的表单,因为您可以看到我从findAllActiveBuyingCurrencies
的方法BranchCurrencyRepository
调用该函数。
->add('currency', EntityType::class, [
'class' => BranchCurrency::class,
'choice_value' => 'rate',
'choice_label' => function($currency){
return $currency->getName() . ' (' . $currency->getCode() .') - '.$currency->getRate().'';
},
'placeholder' => 'Choose currency',
'query_builder' => function (BranchCurrencyRepository $er) {
return $er->findAllActiveBuyingCurrencies();
},
])
这些功能可以显示表格中的所有货币(选项)
但是,我想显示所有货币而我的问题是,只显示25种货币。
请参阅显示所有货币的代码
// branchCurrenciesRepository
public function findAllActiveBuyingCurrencies() {
return $this->createQueryBuilder('currency')
->where('currency.type = :type')
->setParameter('type', BranchCurrencyConstant::Buying);
}
查看
<div class="col-3">
<label for="" class="required">
<strong> Currency <span class="highlight-red"></span></strong>
</label>
{{ form_widget(form.currency) }}
{% if not form.currency.vars.valid %}
<p class="mt10" style="color: #DC2B1B;">{{ form.currency.vars.errors[0].message }}</p>
{% endif %}
</div>