Events.php 5.1 KB

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