我需要一些Symfony和Doctrine表單的幫助。從表格加載的symfony選項選項
我想要的是將選擇小部件添加到窗體,並使用數據庫中的數據加載該選擇小部件。
我有這樣的Survey.class.php:
$this->widgetSchema['service'] = new sfWidgetFormChoice(array(
'choices' => TService::getServiceTypes(),
'multiple' => true,
'expanded' => false));
這是TService.class.php
class TService extends BaseTService
{
static public function getServiceTypes()
{
return Doctrine::getTable("TService")
->createQuery()
->select('description')
->execute();
}
}
我所得到的是兩個選擇一個選擇,那就是好,但是選項是'1'和'2',而不是服務的描述。
Sugestions?
謝謝你們