Events.php 4.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?php
/*
 *  $Id$
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\ORM;

/**
 * Container for all ORM events.
 *
 * This class cannot be instantiated.
 *
29
 * @author Roman Borschel <roman@code-factory.org>
30 31 32 33 34
 * @since 2.0
 */
final class Events
{
    private function __construct() {}
35
    /**
romanb's avatar
romanb committed
36 37
     * The preRemove event occurs for a given entity before the respective
     * EntityManager remove operation for that entity is executed.
38 39 40 41 42
     * 
     * This is an entity lifecycle event.
     * 
     * @var string
     */
romanb's avatar
romanb committed
43
    const preRemove = 'preRemove';
44
    /**
romanb's avatar
romanb committed
45
     * The postRemove event occurs for an entity after the entity has 
46 47 48 49 50 51
     * been deleted. It will be invoked after the database delete operations.
     * 
     * This is an entity lifecycle event.
     * 
     * @var string
     */
romanb's avatar
romanb committed
52
    const postRemove = 'postRemove';
53
    /**
romanb's avatar
romanb committed
54 55
     * The prePersist event occurs for a given entity before the respective
     * EntityManager persist operation for that entity is executed.
56 57 58 59 60
     * 
     * This is an entity lifecycle event.
     * 
     * @var string
     */
romanb's avatar
romanb committed
61
    const prePersist = 'prePersist';
62
    /**
romanb's avatar
romanb committed
63
     * The postPersist event occurs for an entity after the entity has 
64
     * been made persistent. It will be invoked after the database insert operations.
romanb's avatar
romanb committed
65
     * Generated primary key values are available in the postPersist event.
66 67 68 69 70
     * 
     * This is an entity lifecycle event.
     * 
     * @var string
     */
romanb's avatar
romanb committed
71
    const postPersist = 'postPersist';
72 73 74 75 76 77 78 79
    /**
     * The preUpdate event occurs before the database update operations to 
     * entity data. 
     * 
     * This is an entity lifecycle event.
     * 
     * @var string
     */
80
    const preUpdate = 'preUpdate';
81 82 83 84 85 86 87 88
    /**
     * The postUpdate event occurs after the database update operations to 
     * entity data. 
     * 
     * This is an entity lifecycle event.
     * 
     * @var string
     */
89
    const postUpdate = 'postUpdate';
90 91 92 93 94
    /**
     * The postLoad event occurs for an entity after the entity has been loaded
     * into the current EntityManager from the database or after the refresh operation
     * has been applied to it.
     * 
95 96 97 98
     * Note that the postLoad event occurs for an entity before any associations have been
     * initialized. Therefore it is not safe to access associations in a postLoad callback
     * or event handler.
     * 
99 100 101 102
     * This is an entity lifecycle event.
     * 
     * @var string
     */
103
    const postLoad = 'postLoad';
104 105 106 107 108 109
    /**
     * The loadClassMetadata event occurs after the mapping metadata for a class
     * has been loaded from a mapping source (annotations/xml/yaml).
     * 
     * @var string
     */
110
    const loadClassMetadata = 'loadClassMetadata';
111 112 113 114 115 116 117 118 119 120 121
    
    /**
     * The onFlush event occurs when the EntityManager#flush() operation is invoked,
     * after any changes to managed entities have been determined but before any
     * actual database operations are executed. The event is only raised if there is
     * actually something to do for the underlying UnitOfWork. If nothing needs to be done,
     * the onFlush event is not raised.
     * 
     * @var string
     */
    const onFlush = 'onFlush';
122
}