wws-aslan/tactician-doctrine 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wws-aslan/tactician-doctrine

最新稳定版本:v1.1.0

Composer 安装命令:

composer require wws-aslan/tactician-doctrine

包简介

Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction

README 文档

README

Latest Version Software License Build Status Quality Score Total Downloads

This package adds plugins for using Tactician with Doctrine components, either the ORM or just DBAL. The main feature is the ability to wrap each command in a separate database transaction.

Setup

Via Composer

$ composer require wws-aslan/tactician-doctrine

Next, add the ORM\TransactionMiddleware to your CommandBus:

$commandBus = new \League\Tactician\CommandBus(
    [
        new TransactionMiddleware($ormEntityManager)
    ]
);

That's it. Each command you execute will now open and close a new transaction.

If a command fires off more commands, be aware that those commands will run in the same transaction as the parent. It is recommended that you run each command as a separate transaction, so to prevent this from happening, use the LockingMiddleware that ships in Tactician core. This will queue the commands up internally until the parent command has completed.

If an exception is raised while handling the command, the transaction is rolled back, the EntityManager closed, and the exception rethrown.

Symfony integration

When using the [tactician-bundle] (https://github.com/thephpleague/tactician-bundle), don't forget to add the Doctrine middleware to your Symfony config:

tactician:
    commandbus:
        default:
            middleware:
             - tactician.middleware.locking
             - tactician.middleware.doctrine
             - tactician.middleware.command_handler

Testing

$ ./vendor/bin/phpunit

Security

Disclosure information can be found on the main Tactician repo.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-10