简体   繁体   中英

FOSMessageBundle sending a message error

i would like to send a message via FOSMessageBundle so i create a controller witch contain a method named send, after that i got an error in this instuction :

$sender = $this->get('fos_message.sender');
$sender->send($message);

the error message is :

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

The message must me created.

Something like $message = $builder->newThread(); or $message = $builder->reply($thread);

While you apparently have just $message = $builder;

thanks qooplmao and yonel i just find the mistake, that i forget to extend the BaseMessage in the class of $message object. BaseMessage implement the MessageInterface.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM