项目作者: steevanb

项目描述 :
Add events to Doctrine
高级语言: PHP
项目地址: git://github.com/steevanb/doctrine-events.git
创建时间: 2016-12-12T14:33:41Z
项目社区:https://github.com/steevanb/doctrine-events

开源协议:

下载


version
doctrine
php
Lines
Total Downloads
SensionLabsInsight
Scrutinizer

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()

Changelog

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 :

  1. {
  2. "require": {
  3. "steevanb/doctrine-events": "^1.2",
  4. }
  5. }

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 :

  1. # app/config.yml
  2. parameters:
  3. 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