问题
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