我们可以覆盖模型访问者属性名称还是忽略它?
这里是我的User::getUsername
函数,它是电子邮件属性的getter(我需要这个函数来命名,以实现接口):
class User extends AbstractDocument implements AdvancedUserInterface, EquatableInterface
{
/**
* @var string
* @Assert\NotBlank()
* @Assert\Email()
* @SWG\Property(
* description="The email of the user",
* example="example@company.com"
* )
*/
private $email;
//...
/**
* Returns the username used to authenticate the user.
* @return string The user email
* @SWG\Property(property="email")
*/
public function getUsername()
{
return $this->email;
}
}
生成的文档仍显示:
{
"User": {
"properties":{
"email":{
"description":"The email of the user",
"example":"example@company.com",
"type":"string"
},
"username":{
"type":"string"
}
}
}
}
你能帮帮我吗?