FatalErrorException:在null上调用成员函数getFirstName()

时间:2015-06-02 06:23:49

标签: symfony-2.5

请帮帮我

  

在第55行的C:\ xampp \ htdocs \ project_sms \ src \ Com \ AkSolutions \ Sms \ UserBundle \ Form \ Type \ UserSendMessageType.php

$form = $event->getForm();
$form->getData()->setFromUserId($this->user->getId());
$form->getData()->setFromName($this->userProfile->getFirstName()."".$this->userProfile->getLastName());
$form->getData()->setUserType($this->userType);
$form->getData()->setReadStatus(false);
$form->getData()->setDeleteStatus(false); 

1 个答案:

答案 0 :(得分:0)

问题似乎在这里:

$this->userProfile->getFirstName()

特别是错误告诉你这个表达式:

$this->userProfile

为空