appventus/swiftmailerdbbundle

此包已被废弃且不再维护。未建议替代包。

支持短信的SwiftMailer数据库缓存

1.0.0 2015-09-20 21:39 UTC

This package is auto-updated.

Last update: 2023-08-09 10:35:12 UTC


README

此包简化了使用SwiftMailer和Symfony2将消息缓存到数据库的过程。

目前,它仅支持与Doctrine EntityManager和由此管理的实体一起使用。

安装

首先,将包添加到您的项目中。

通过Composer:

  1. 在您的composer.json要求部分添加以下行

    { "require": { "whiteoctober/swiftmailerdbbundle": "dev-master" } }

  2. 通过Composer下载包

    $ php composer.phar update whiteoctober/swiftmailerdbbundle

通过deps文件:

  1. 在您的deps文件中添加以下行

    [WhiteOctoberSwiftMailerDBBundle] git=git://github.com/whiteoctober/WhiteOctoberSwiftMailerDBBundle.git target=/bundles/WhiteOctober/SwiftMailerDBBundle

Run the vendors script:

    ./bin/vendors install
  1. 将WhiteOctober命名空间添加到自动加载器中

    // app/autoload.php $loader->registerNamespaces(array( 'WhiteOctober' => DIR.'/../vendor/bundles', ));

一旦您已将包下载到Symfony项目中,您需要将其添加到内核中,并添加一些配置参数,以便它知道您想使用哪个实体。

  1. 将包添加到您的应用程序内核中

    // app/AppKernel.php public function registerBundles() { return array( // ... new WhiteOctober\SwiftMailerDBBundle\WhiteOctoberSwiftMailerDBBundle(), // ... ); }

  2. 在您的config.yml中配置white_october_swift_mailer_db服务

    white_october_swift_mailer_db: entity_class: 全路径到Mail实体

    请阅读以下如何构建此实体。

  3. 告诉SwiftMailer使用数据库缓存

    swiftmailer: spool: type: db

这就是包的安装和配置的全部内容。

邮件实体

您需要创建一个可以持久化的实体,并从包中的EmailInterface接口扩展。目前,此包期望您的实体中有一个名为'status'的属性,因为该字段将被查询。

一旦您的实体设置完毕,请使用如上所述的完全命名空间路径在config.yml配置文件中使用。