[345] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 6 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 7 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 8 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
| 9 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 10 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
| 11 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 12 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 13 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 14 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
| 15 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 16 | * |
---|
| 17 | * This software consists of voluntary contributions made by many individuals |
---|
| 18 | * and is licensed under the LGPL. For more information, see |
---|
| 19 | * <http://www.doctrine-project.org>. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | namespace Doctrine\ORM; |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * Container for all ORM events. |
---|
| 26 | * |
---|
| 27 | * This class cannot be instantiated. |
---|
| 28 | * |
---|
| 29 | * @author Roman Borschel <roman@code-factory.org> |
---|
| 30 | * @since 2.0 |
---|
| 31 | */ |
---|
| 32 | final class Events |
---|
| 33 | { |
---|
| 34 | private function __construct() {} |
---|
| 35 | /** |
---|
| 36 | * The preRemove event occurs for a given entity before the respective |
---|
| 37 | * EntityManager remove operation for that entity is executed. |
---|
| 38 | * |
---|
| 39 | * This is an entity lifecycle event. |
---|
| 40 | * |
---|
| 41 | * @var string |
---|
| 42 | */ |
---|
| 43 | const preRemove = 'preRemove'; |
---|
| 44 | /** |
---|
| 45 | * The postRemove event occurs for an entity after the entity has |
---|
| 46 | * been deleted. It will be invoked after the database delete operations. |
---|
| 47 | * |
---|
| 48 | * This is an entity lifecycle event. |
---|
| 49 | * |
---|
| 50 | * @var string |
---|
| 51 | */ |
---|
| 52 | const postRemove = 'postRemove'; |
---|
| 53 | /** |
---|
| 54 | * The prePersist event occurs for a given entity before the respective |
---|
| 55 | * EntityManager persist operation for that entity is executed. |
---|
| 56 | * |
---|
| 57 | * This is an entity lifecycle event. |
---|
| 58 | * |
---|
| 59 | * @var string |
---|
| 60 | */ |
---|
| 61 | const prePersist = 'prePersist'; |
---|
| 62 | /** |
---|
| 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. |
---|
| 65 | * Generated primary key values are available in the postPersist event. |
---|
| 66 | * |
---|
| 67 | * This is an entity lifecycle event. |
---|
| 68 | * |
---|
| 69 | * @var string |
---|
| 70 | */ |
---|
| 71 | const postPersist = 'postPersist'; |
---|
| 72 | /** |
---|
| 73 | * The preUpdate event occurs before the database update operations to |
---|
| 74 | * entity data. |
---|
| 75 | * |
---|
| 76 | * This is an entity lifecycle event. |
---|
| 77 | * |
---|
| 78 | * @var string |
---|
| 79 | */ |
---|
| 80 | const preUpdate = 'preUpdate'; |
---|
| 81 | /** |
---|
| 82 | * The postUpdate event occurs after the database update operations to |
---|
| 83 | * entity data. |
---|
| 84 | * |
---|
| 85 | * This is an entity lifecycle event. |
---|
| 86 | * |
---|
| 87 | * @var string |
---|
| 88 | */ |
---|
| 89 | const postUpdate = 'postUpdate'; |
---|
| 90 | /** |
---|
| 91 | * The postLoad event occurs for an entity after the entity has been loaded |
---|
| 92 | * into the current EntityManager from the database or after the refresh operation |
---|
| 93 | * has been applied to it. |
---|
| 94 | * |
---|
| 95 | * Note that the postLoad event occurs for an entity before any associations have been |
---|
| 96 | * initialized. Therefore it is not safe to access associations in a postLoad callback |
---|
| 97 | * or event handler. |
---|
| 98 | * |
---|
| 99 | * This is an entity lifecycle event. |
---|
| 100 | * |
---|
| 101 | * @var string |
---|
| 102 | */ |
---|
| 103 | const postLoad = 'postLoad'; |
---|
| 104 | /** |
---|
| 105 | * The loadClassMetadata event occurs after the mapping metadata for a class |
---|
| 106 | * has been loaded from a mapping source (annotations/xml/yaml). |
---|
| 107 | * |
---|
| 108 | * @var string |
---|
| 109 | */ |
---|
| 110 | const loadClassMetadata = 'loadClassMetadata'; |
---|
| 111 | |
---|
| 112 | /** |
---|
| 113 | * The preFlush event occurs when the EntityManager#flush() operation is invoked, |
---|
| 114 | * but before any changes to managed entites have been calculated. This event is |
---|
| 115 | * always raised right after EntityManager#flush() call. |
---|
| 116 | */ |
---|
| 117 | const preFlush = 'preFlush'; |
---|
| 118 | |
---|
| 119 | /** |
---|
| 120 | * The onFlush event occurs when the EntityManager#flush() operation is invoked, |
---|
| 121 | * after any changes to managed entities have been determined but before any |
---|
| 122 | * actual database operations are executed. The event is only raised if there is |
---|
| 123 | * actually something to do for the underlying UnitOfWork. If nothing needs to be done, |
---|
| 124 | * the onFlush event is not raised. |
---|
| 125 | * |
---|
| 126 | * @var string |
---|
| 127 | */ |
---|
| 128 | const onFlush = 'onFlush'; |
---|
| 129 | |
---|
| 130 | /** |
---|
| 131 | * The postFlush event occurs when the EntityManager#flush() operation is invoked and |
---|
| 132 | * after all actual database operations are executed successfully. The event is only raised if there is |
---|
| 133 | * actually something to do for the underlying UnitOfWork. If nothing needs to be done, |
---|
| 134 | * the postFlush event is not raised. The event won't be raised if an error occurs during the |
---|
| 135 | * flush operation. |
---|
| 136 | * |
---|
| 137 | * @var string |
---|
| 138 | */ |
---|
| 139 | const postFlush = 'postFlush'; |
---|
| 140 | |
---|
| 141 | /** |
---|
| 142 | * The onClear event occurs when the EntityManager#clear() operation is invoked, |
---|
| 143 | * after all references to entities have been removed from the unit of work. |
---|
| 144 | * |
---|
| 145 | * @var string |
---|
| 146 | */ |
---|
| 147 | const onClear = 'onClear'; |
---|
| 148 | } |
---|