sfWidgetFormDoctrineChoice renders only one value but query returns 5 values

风流意气都作罢 提交于 2019-12-24 19:54:53

问题


I'm using a sfWidgetFormDoctrineChoice in a Symfony form in this way:

$this->widgetSchema['no_emisor'] = new sfWidgetFormDoctrineChoice(array('model' => 'SdrivingEmisor', 'add_empty' => true));

I tried also with:

$this->widgetSchema['no_emisor'] = new sfWidgetFormDoctrineChoice(array('model' => 'SdrivingEmisor', 'add_empty' => 'Seleccione un Emisor', 'expanded' => false, 'multiple' => false));
$this->widgetSchema['no_emisor'] = new sfWidgetFormDoctrineChoice(array('model' => 'SdrivingEmisor', 'add_empty' => 'Seleccione un Emisor', 'expanded' => false));
$this->widgetSchema['no_emisor'] = new sfWidgetFormDoctrineChoice(array('model' => 'SdrivingEmisor', 'add_empty' => 'Seleccione un Emisor', 'multiple' => false));

But at HTML level, when I show the form, only one value is rendered:

<select id="sdriving_maquina_no_emisor" name="sdriving_maquina[no_emisor]" label="Emisor">
    <option selected="selected" value=""></option>
    <option value="1">96510020</option>
</select>

Although the generated query:

SELECT s.idemisor AS s__idemisor, s.idempresa AS s__idempresa, s.numero AS s__numero, s.created_at AS s__created_at, s.updated_at AS s__updated_at
FROM sdriving_emisor s

in phpMyAdmin returns 5 rows, what's wrong here?

来源:https://stackoverflow.com/questions/17179725/sfwidgetformdoctrinechoice-renders-only-one-value-but-query-returns-5-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!