创建实体后发送邮件 | Symfony2 奏鸣曲管理包
Sending a mail after creating of an entity | Symfony2 Sonata Admin Bundle
我想创建一个侦听器,它应该在创建实体后发送电子邮件。
我正在使用 Sonata Admin Bundle,但我不太清楚什么事件与实体的创建相关联。
您可以为 Doctrine postFlush
事件注册事件监听器。
示例监听器:
class PostFlushExampleListener
{
public function postFlush(PostFlushEventArgs $args)
{
// ...
}
}
Symfony 中的服务注册:
services:
my.listener:
class: PostFlushExampleListener
tags:
- { name: doctrine.event_listener, event: postFlush }
Symfony 文档:http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html
我想创建一个侦听器,它应该在创建实体后发送电子邮件。
我正在使用 Sonata Admin Bundle,但我不太清楚什么事件与实体的创建相关联。
您可以为 Doctrine postFlush
事件注册事件监听器。
示例监听器:
class PostFlushExampleListener
{
public function postFlush(PostFlushEventArgs $args)
{
// ...
}
}
Symfony 中的服务注册:
services:
my.listener:
class: PostFlushExampleListener
tags:
- { name: doctrine.event_listener, event: postFlush }
Symfony 文档:http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html