Download the PHP package tourze/doctrine-async-insert-bundle without Composer
On this page you can find all versions of the php package tourze/doctrine-async-insert-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/doctrine-async-insert-bundle
More information about tourze/doctrine-async-insert-bundle
Files in tourze/doctrine-async-insert-bundle
Package doctrine-async-insert-bundle
Short Description A Symfony bundle that provides asynchronous database insert operations for Doctrine entities, built on top of Symfony Messenger component for high-performance data insertion.
License MIT
Informations about the package doctrine-async-insert-bundle
Doctrine Async Insert Bundle
δΈζ
A Symfony bundle that provides asynchronous database insert operations for Doctrine entities, built on top of Symfony Messenger component for high-performance data insertion.
Features
- π Asynchronous database insert operations - Execute database inserts asynchronously to improve response times
- π Duplicate entry detection and handling - Configurable duplicate entry error handling with logging
- β° Delayed execution support - Schedule inserts with configurable delays using Symfony Messenger DelayStamp
- π Comprehensive logging - Full logging for all insert operations with detailed error tracking
- π§ Fallback mechanism - Automatic fallback to synchronous insert when async fails
- π― Entity-aware - Direct entity support with automatic SQL generation
- π Environment-based control - Force synchronous mode via environment variable
Installation
Quick Start
Bundle Registration
Add to your config/bundles.php:
Basic Usage
Documentation
Configuration
Environment Variables
FORCE_REPOSITORY_SYNC_INSERT=true- Force synchronous insert mode (bypasses async)
Messenger Configuration
Ensure your config/packages/messenger.yaml includes the routing:
Advanced Usage
Delay and Duplicate Handling
Manual Message Dispatch
Architecture
Components
- AsyncInsertService - Main service for asynchronous entity insertion
- InsertTableMessage - Message object for async processing
- InsertTableHandler - Message handler for processing insert operations
- DoctrineAsyncInsertBundle - Bundle class for service registration
Flow
- Entity is passed to
AsyncInsertService - SQL and parameters are extracted from entity
InsertTableMessageis created and dispatchedInsertTableHandlerprocesses the message asynchronously- On failure, fallback to synchronous insert
Error Handling
The bundle includes comprehensive error handling:
- Duplicate entry errors - Configurable handling with logging
- Message dispatch failures - Automatic fallback to direct insert
- Insert failures - Detailed error logging with context
Dependencies
This bundle depends on:
symfony/messenger- For asynchronous message handlingdoctrine/orm- For entity managementdoctrine/dbal- For database operationstourze/doctrine-direct-insert-bundle- For fallback direct insertiontourze/doctrine-entity-checker-bundle- For SQL formatting
Testing
Run the test suite:
Coverage: All tests pass with 100% assertion coverage.
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
All versions of doctrine-async-insert-bundle with dependencies
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
monolog/monolog Version ^3.1
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/framework-bundle Version ^7.4
symfony/http-kernel Version ^7.3
symfony/messenger Version ^7.3
symfony/property-access Version ^7.3
symfony/service-contracts Version ^3.6
symfony/yaml Version ^7.3
tourze/async-contracts Version 1.0.*
tourze/bundle-dependency Version 1.*
tourze/doctrine-direct-insert-bundle Version 1.0.*
tourze/doctrine-entity-checker-bundle Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.0.*
yiisoft/json Version ^1.0