I know :D !! $choice = Doctrine::getTable('SfGuardUserProfile')->getSomething();
foreach ($choice as $w): $table[$w->getId()] = $w->getCity(); endforeach; $this->setWidgets(array( 'city' => new sfWidgetFormSelect(array('choices' => $table)), )); On 13 Mar, 11:34, dziobacz <aaabbbcccda...@gmail.com> wrote: > I would like to make select list where each option name is from > database - city and value is also from database - id. > > I have made that query (it return id and city): > > public function getSomething() > { > $q = Doctrine_Query::create() > ->select('s.id, s.city') > ->from('SfGuardUserProfile s'); > > return $q->execute(); > } > > My form is: > > class ChoiceForm extends sfForm > { > public function configure() > { > > $database = Doctrine::getTable('SfGuardUserProfile')->getSomething > (); > > $this->setWidgets(array( > 'test' => new sfWidgetFormSelect(array('choices' => array( ))), > )); > > $this->widgetSchema->setNameFormat('data[%s]'); > } > > } > > How can I make that it will be: 'choices' => array(id => city ) ???? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---