我想通過FOSMessageBundle發送消息,所以我創建一個控制器巫婆包含一個名爲send方法,在那之後我得到了這個instuction一個錯誤:FOSMessageBundle發送消息錯誤
$sender = $this->get('fos_message.sender');
$sender->send($message);
錯誤消息:
Catchable Fatal Error: Argument 1 passed to FOS\MessageBundle\Sender\Sender::send() must implement interface FOS\MessageBundle\Model\MessageInterface, instance of FOS\MessageBundle\MessageBuilder\NewThreadMessageBuilder given, called in /projet/pivotalpartnersbo/src/Application/Sonata/MessageBundle/Controller/MessageController.php on line 32
只要確保傳遞一個'MessageInterface'實例來發送方法,就會清除錯誤消息。 – yceruto
您需要從構建器獲取消息,並像'$ sender-> send($ builder-> getMessage());' – qooplmao