我给出了以下错误:
Catchable Fatal Error: Argument 1 passed to BackendBundle'Entity'Notification::sendSystemMessage()
must be an instance of BackendBundle'Entity'BackendBundle'Entity'User, instance of
Proxies'__CG__'BackendBundle'Entity'User given
我在通知.php类中的方法是:
/**
* Send System message, to be used after creating a blank one
*
* @param 'BackendBundle'Entity'User $reciever
*
* @param string $message
*
* @return Notification
*/
public function sendSystemMessage(BackendBundle'Entity'User $reciever, $message)
{
$this->setReciever($reciever);
$this->setMessage($message);
$this->setTimestamp(new 'DateTime());
$this->setReaded(false);
$this->setSystemMessage(true);
return $this;
}
当我使用像setReciever这样的setter和getter时,它工作得很好,但是当我尝试调用多个参数时,我得到了这个错误,我犯了一个错误,或者实体类中不能有多个参数方法?
Credits to Cerad。
我的问题是我有
public function sendSystemMessage(BackendBundle'Entity'User $reciever, $message)
当我需要时
public function sendSystemMessage('BackendBundle'Entity'User $reciever, $message)
反斜杠为用户类提供了不同的路径