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'));
精彩评论