开发者

getRelatedModelName - how show other column?

In abstract class BaseNewsForm extends BaseFormDoctrine

i have widget:

  'user_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),

When i have add new News then i have list choice with ID all Users. How c开发者_开发知识库an i make change this list for Lastname? In table Users i have

id | username | name | lastname

i know that i must in NewsForm add:

$this->setWidget('user_id', new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true));

but how can i this edit for get Lastname, not ID?


$this->setWidget('user_id', new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true, 'method' => 'getLastname'));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜