DDC-1980: [GH-423] DDC-1955 - @EntityListeners #2654

Closed
doctrinebot opened this Issue Aug 12, 2012 · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of FabioBatSilva:

Url: #423

Message:

http://www.doctrine-project.org/jira/browse/[DDC-1955](http://www.doctrine-project.org/jira/browse/DDC-1955)

Hi.

This path adds support for @EntityListeners

This path add another way to handle events
allow configure the same listener for many specific entities.
And give the EventArg in the current lifecycle callback system.

Usage :

<?php
/****
 * @EntityListeners({"ContractListener"})
 * @HasLifecycleCallbacks
 * @Entity  
 */
class Contract
{
    /*** @PostLoad **/
    public function postLoadHandler(LifecycleEventArgs $event)
    {
        // do something
    }
}
class ContractListener
{
    /*** @PrePersist  **/
    public function prePersistHandler(Contract $contract)
    {
        // do something
    }
    /****
     * @PostPersist
     * Most of cases just the entity is needed.
     * as a second parameter LifecycleEventArgs allow access to the entity manager.
     */
    public function postPersistHandler(Contract $contract, LifecycleEventArgs $args)
    {
        // do something
    }
}
@doctrinebot

Comment created by @FabioBatSilva:

Merged : 71a68a5

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-423] was closed:
doctrine/dbal#423

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.4 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment