I had given the following error:
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
the method I have in my Notification.php class is:
/**
* 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;
}
when I use the setters and getters like setReciever, it works perfectly, but when I try to call multiple params I got this error, I'm I making a mistake or there can't be a multiple parameters method in the entities classes?
Credits to Cerad.
My problem was that I had
public function sendSystemMessage(BackendBundle\Entity\User $reciever, $message)
when I needed
public function sendSystemMessage(\BackendBundle\Entity\User $reciever, $message)
that backslash was getting me a different path for the User class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.