steevanb / doctrine-events
Add Doctrine events
Installs: 2 375
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^5.4.6 || ^7.0
- doctrine/orm: ^2.5.0
README
doctrine-events
Add some events to Doctrine 2.5
Fix a Doctrine UnitOfwork bug with extraUpdates, who are not removed when you add and remove your entity before calling flush()
onCreateEntityOverrideLocalValues
Dispatched when UnitOfWork try to know if current entity must be filled with values retrieved from query, or if this entity is already known and fields are already defined.
onCreateEntityDefineFieldValues
Dispactched when UnitOfWork define entity field values
onNewEntityInstance
Dispactched when UnitOfWork create new instance of your Entity
Installation
Add it to your composer.json :
{ "require": { "steevanb/doctrine-events": "^1.2", } }
You have to use steevanb\DoctrineEvents\Doctrine\ORM\EntityManager instead of Doctrine\ORM\EntityManager
Internally, it will use steevanb\DoctrineEvents\Doctrine\ORM\UnitOfWork instead of Doctrine\ORM\UnitOfWork
If you are on Symfony2 or Symfony3 project, you can add it to your config :
# app/config.yml parameters: doctrine.orm.entity_manager.class: steevanb\DoctrineEvents\Doctrine\ORM\EntityManager
Some lib who use it
https://github.com/steevanb/doctrine-entity-merger : add MERGE_ENTITY hint to define fields loaded with multiple queries, with PARTIAL, instead of returning first hydrated entity