我正在使用这个,但我收到错误
foo_bundle.listener.comment:
class: xxx\Listener\CupleListener
arguments: [@mailer]
class CupleListener
{
protected $mailer;
public function __construct(Swift_Mailer $mailer)
{
$this->mailer = $mailer;
}
public function onCenterEvent(CupleEvent $event)
{
$center = $event->getcenter();
$message = \Swift_Message::newInstance()
->setSubject('New comment posted on ' . $post->getTitle())
->setFrom('send@example.com')
->setTo('xxxxxxxxxx')
->setBody("Hey, somebody left a new comment on a post you're subscribed to! It says: " . $comment->getBody());
$this->mailer->send($message);
}
}
这是给出错误
我也不知道要在命名空间顶部包含哪个类