Download the PHP package aeatech/transaction-manager-bundle without Composer
On this page you can find all versions of the php package aeatech/transaction-manager-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aeatech/transaction-manager-bundle
More information about aeatech/transaction-manager-bundle
Files in aeatech/transaction-manager-bundle
Package transaction-manager-bundle
Short Description Symfony bundle that glues AEATech Transaction Manager into the Symfony ecosystem, providing Doctrine DBAL integration, multiple transaction managers.
License MIT
Informations about the package transaction-manager-bundle
AEATech Transaction Manager Bundle
Symfony bundle that integrates AEATech Transaction Manager into the Symfony ecosystem.
Features
- Multiple Transaction Managers: Configure different managers for different database connections.
- Doctrine DBAL Integration: Out-of-the-box support for Doctrine connections via
aeatech/transaction-manager-doctrine-adapter. - Platform-Specific Factories: Convenient interfaces for creating MySQL and PostgreSQL transactions.
- Advanced Retry Policies: Customizable exponential backoff strategies with jitter.
- PHP Attributes Support: Easy autoconfiguration for custom heuristics, classifiers, and adapters.
- Lazy Loading: Managers are initialized only when first accessed via a service locator.
Table of Contents
- Prerequisites
- Installation
- Configuration
- YAML Configuration
- Autoconfiguration with PHP Attributes
- Usage
- Basic Example
- Autowiring
- Using Registry
- Testing
- Development
Prerequisites
- PHP 8.2 or higher
- Symfony 6.4 or 7.x
Installation
Depending on your database, you also need to install the corresponding driver package:
For MySQL
For PostgreSQL
For Doctrine DBAL (Adapter)
Configuration
The bundle allows you to configure multiple transaction managers, each with its own platform and connection.
YAML Configuration
Configuration Options
- Connection Adapter:
doctrine: Requiresaeatech/transaction-manager-doctrine-adapter. Specify the connection name.service: Provide a service ID implementingConnectionInterface.
- Execution Plan Builder:
deferred_build_resolver.strategy: How to detect transactions that need deferred building.deferred_build_resolver.service: Custom service ID implementingDeferredBuildResolverInterface.
- Error Classifier:
service: Custom service ID implementingErrorClassifierInterface.heuristics: Custom service ID implementingDatabaseErrorHeuristicsInterface.
Autoconfiguration with PHP Attributes
The bundle provides PHP attributes to configure certain services automatically without modifying the YAML configuration. This is the recommended way for most use cases.
Note: If you configure a component (like heuristics or a classifier) for a manager both in YAML and via an attribute, an
InvalidConfigurationExceptionwill be thrown.
Available Attributes
All attributes accept a managerNames parameter (string or array of strings).
| Attribute | Interface | Description |
|---|---|---|
#[AsHeuristics] |
DatabaseErrorHeuristicsInterface |
Overrides platform-specific error heuristics. |
#[AsErrorClassifier] |
ErrorClassifierInterface |
Provides custom error classification logic. |
#[AsDeferredBuildResolver] |
DeferredBuildResolverInterface |
Customizes how deferred builds are detected. |
#[AsConnectionAdapter] |
ConnectionInterface |
Provides a custom database connection adapter. |
#[AsRetryPolicyBackoff] |
BackoffStrategyInterface |
Implements a custom retry backoff strategy. |
Example:
Usage
Basic Example
The main way to interact with the bundle is through the TransactionManagerInterface and platform-specific factories.
Autowiring
Default Manager
Specific Manager
Transaction Factories
The bundle automatically creates aliases for platform-specific transaction factories for the default manager's platform.
Using Transaction Manager Registry
If you need to select a manager at runtime (e.g., in a worker or for multi-tenant applications), use TransactionManagerRegistryInterface.
Testing
When writing unit tests for your services, you should mock TransactionManagerInterface.
Using Mockery:
Development
Start the Environment
Install Dependencies
Run Tests
PHPStan
Stop the Environment
License
This project is licensed under the MIT License. See the LICENSE file for details.
All versions of transaction-manager-bundle with dependencies
ext-pdo Version *
aeatech/transaction-manager-core Version ^1.0
symfony/config Version ^6.4.15 || ^7.0
symfony/dependency-injection Version ^6.4.15 || ^7.0
symfony/framework-bundle Version ^6.4.15 || ^7.0
symfony/yaml Version ^6.4.15 || ^7.0