tourze/workerman-doctrine-bundle 问题修复 & 功能扩展

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

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

tourze/workerman-doctrine-bundle

最新稳定版本:0.0.3

Composer 安装命令:

composer require tourze/workerman-doctrine-bundle

包简介

Workerman + DoctrineORM

README 文档

README

English | 中文

Latest Version Total Downloads

A Symfony bundle that provides integration between Workerman and Doctrine ORM, ensuring proper entity manager lifecycle management in long-running processes.

Features

  • Entity Manager Monitoring: Automatically monitors Doctrine EntityManager state in Workerman processes
  • Process Protection: Automatically stops Workerman processes when EntityManager is closed to prevent data corruption
  • Seamless Integration: Works with both HTTP and Console events
  • Zero Configuration: Works out of the box with minimal setup

Installation

composer require tourze/workerman-doctrine-bundle

Quick Start

  1. Add the bundle to your config/bundles.php:
<?php

return [
    // ... other bundles
    Tourze\WorkermanDoctrineBundle\WorkermanDoctrineBundle::class => ['all' => true],
];
  1. The bundle will automatically register its services and event listeners.

How It Works

The bundle includes an EntityManagerWatchSubscriber that monitors the Doctrine EntityManager state:

  • Automatic Monitoring: Listens to KernelEvents::TERMINATE and ConsoleEvents::TERMINATE events
  • Process Safety: When the EntityManager is closed (usually due to an exception), the subscriber automatically stops all Workerman processes
  • Clean Shutdown: Prevents data corruption by ensuring processes restart with a fresh EntityManager

Use Cases

This bundle is particularly useful when:

  • Running Symfony applications with Workerman in long-running processes
  • Needing to ensure database connection stability
  • Preventing EntityManager-related issues in high-concurrency scenarios
  • Building robust long-running web services

Requirements

  • PHP 8.1 or higher
  • Symfony 6.4 or higher
  • Doctrine ORM 3.0 or higher
  • Workerman 5.1 or higher
  • ext-pcntl extension

Contributing

Please see CONTRIBUTING.md for details.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-21