Download the PHP package tourze/doctrine-entity-checker-bundle without Composer
On this page you can find all versions of the php package tourze/doctrine-entity-checker-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/doctrine-entity-checker-bundle
More information about tourze/doctrine-entity-checker-bundle
Files in tourze/doctrine-entity-checker-bundle
Package doctrine-entity-checker-bundle
Short Description A Symfony Bundle that provides Doctrine entity checking and processing capabilities with custom checkers, ID generators, and SQL formatting tools.
License MIT
Informations about the package doctrine-entity-checker-bundle
Doctrine Entity Checker Bundle
中文
A Symfony Bundle that provides Doctrine entity checking and processing capabilities. Through custom checkers, you can automatically handle specific logic before entity persistence.
Table of Contents
- Features
- Installation
- Requirements
- Quick Start
- Configuration
- Advanced Usage
- API Reference
- Testing
- Contributing
- License
Features
- Automatic entity processing before persistence
- Support for custom ID generators with
#[ORM\CustomIdGenerator]attribute - Entity primary key management utilities
- SQL formatting and generation tools
- Lazy-loaded services for optimal performance
- Support for composite primary keys
Installation
Install via Composer:
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
Quick Start
-
Register the Bundle
- Create a custom entity checker
The checker will be automatically registered due to the #[AutoconfigureTag] attribute.
Configuration
The bundle works out of the box with minimal configuration. All services are automatically configured with lazy loading for optimal performance.
Service Configuration
All services in this bundle are configured as lazy-loaded by default:
EntityChecker- Main entity processing serviceEntityPrimaryKeyService- Primary key utilitiesSqlFormatter- SQL generation utilities
These services are automatically injected when needed and support dependency injection.
Custom Configuration
If you need to customize service behavior, you can override services in your
config/services.yaml:
Advanced Usage
Custom ID Generator
Use the #[ORM\CustomIdGenerator] attribute to specify custom ID generators:
Primary Key Service
Get primary key information from entities:
SQL Formatting
Generate SQL from entities:
API Reference
EntityCheckerInterface
prePersistEntity(ObjectManager $objectManager, object $entity): void- Called before entity persistencepreUpdateEntity(ObjectManager $objectManager, object $entity, PreUpdateEventArgs $eventArgs): void- Called before entity update
EntityPrimaryKeyService
getPrimaryKeyValues(object $entity): array- Get primary key valueshasCompositeIdentifier(string|object $entityClass): bool- Check for composite primary keygetIdentifierFieldNames(string|object $entityClass): array- Get primary key field names
SqlFormatter
getObjectInsertSql(ObjectManager $objectManager, object $object): array- Generate insert SQL datafromOrmQuery(OrmQuery $query): string- Format DQL with parameters
Testing
Run tests:
Run PHPStan analysis:
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
All versions of doctrine-entity-checker-bundle with dependencies
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
psr/container Version ^1.1|^2.0
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/symfony-dependency-service-loader Version 1.0.*
yiisoft/json Version ^1.0
yiisoft/strings Version ^2.1