定制 dualmedia/doctrine-retry-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dualmedia/doctrine-retry-bundle

最新稳定版本:1.1.1

Composer 安装命令:

composer require dualmedia/doctrine-retry-bundle

包简介

Bundle for easy access to retryable doctrine transactions

README 文档

README

Packagist Downloads

Doctrine Retry Bundle

A Symfony Bundle for easy retryable database transactions.

Install

Simply composer require dualmedia/doctrine-retry-bundle

Then add the bundle to your config/bundles.php file like so

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    // other bundles ...
    DualMedia\DoctrineRetryBundle\DoctrineRetryBundle::class => ['all' => true],
];

Setup

You're free to leave the configuration as-is, otherwise all you can change is the following:

dm_doctrine_retry:
  track_nesting: '%kernel.debug%' # if true, Retrier will warn you if you nest transaction calls

Usage

use DualMedia\DoctrineRetryBundle\Retrier;
use Doctrine\ORM\EntityManagerInterface;

class Foo {
    public function __construct(
        private readonly Retrier $retrier
    ) {}
    
    public function doWork(
        int $orderId
    ): void {
        $this->retrier->execute(function (EntityManagerInterface $em) use ($orderId): void {
            // do some work which may cause deadlocks and such
            $order = $em->getRepository(SomeOrder::class)->find($orderId, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE);
        });
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-16