Events.php 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. private function __construct() {}
  31. /**
  32. * The preRemove event occurs for a given entity before the respective
  33. * EntityManager remove operation for that entity is executed.
  34. *
  35. * This is an entity lifecycle event.
  36. *
  37. * @var string
  38. */
  39. const preRemove = 'preRemove';
  40. /**
  41. * The postRemove event occurs for an entity after the entity has
  42. * been deleted. It will be invoked after the database delete operations.
  43. *
  44. * This is an entity lifecycle event.
  45. *
  46. * @var string
  47. */
  48. const postRemove = 'postRemove';
  49. /**
  50. * The prePersist event occurs for a given entity before the respective
  51. * EntityManager persist operation for that entity is executed.
  52. *
  53. * This is an entity lifecycle event.
  54. *
  55. * @var string
  56. */
  57. const prePersist = 'prePersist';
  58. /**
  59. * The postPersist event occurs for an entity after the entity has
  60. * been made persistent. It will be invoked after the database insert operations.
  61. * Generated primary key values are available in the postPersist event.
  62. *
  63. * This is an entity lifecycle event.
  64. *
  65. * @var string
  66. */
  67. const postPersist = 'postPersist';
  68. /**
  69. * The preUpdate event occurs before the database update operations to
  70. * entity data.
  71. *
  72. * This is an entity lifecycle event.
  73. *
  74. * @var string
  75. */
  76. const preUpdate = 'preUpdate';
  77. /**
  78. * The postUpdate event occurs after the database update operations to
  79. * entity data.
  80. *
  81. * This is an entity lifecycle event.
  82. *
  83. * @var string
  84. */
  85. const postUpdate = 'postUpdate';
  86. /**
  87. * The postLoad event occurs for an entity after the entity has been loaded
  88. * into the current EntityManager from the database or after the refresh operation
  89. * has been applied to it.
  90. *
  91. * Note that the postLoad event occurs for an entity before any associations have been
  92. * initialized. Therefore it is not safe to access associations in a postLoad callback
  93. * or event handler.
  94. *
  95. * This is an entity lifecycle event.
  96. *
  97. * @var string
  98. */
  99. const postLoad = 'postLoad';
  100. /**
  101. * The loadClassMetadata event occurs after the mapping metadata for a class
  102. * has been loaded from a mapping source (annotations/xml/yaml).
  103. *
  104. * @var string
  105. */
  106. const loadClassMetadata = 'loadClassMetadata';
  107. /**
  108. * The preFlush event occurs when the EntityManager#flush() operation is invoked,
  109. * but before any changes to managed entites have been calculated. This event is
  110. * always raised right after EntityManager#flush() call.
  111. */
  112. const preFlush = 'preFlush';
  113. /**
  114. * The onFlush event occurs when the EntityManager#flush() operation is invoked,
  115. * after any changes to managed entities have been determined but before any
  116. * actual database operations are executed. The event is only raised if there is
  117. * actually something to do for the underlying UnitOfWork. If nothing needs to be done,
  118. * the onFlush event is not raised.
  119. *
  120. * @var string
  121. */
  122. const onFlush = 'onFlush';
  123. /**
  124. * The postFlush event occurs when the EntityManager#flush() operation is invoked and
  125. * after all actual database operations are executed successfully. The event is only raised if there is
  126. * actually something to do for the underlying UnitOfWork. If nothing needs to be done,
  127. * the postFlush event is not raised. The event won't be raised if an error occurs during the
  128. * flush operation.
  129. *
  130. * @var string
  131. */
  132. const postFlush = 'postFlush';
  133. /**
  134. * The onClear event occurs when the EntityManager#clear() operation is invoked,
  135. * after all references to entities have been removed from the unit of work.
  136. *
  137. * @var string
  138. */
  139. const onClear = 'onClear';
  140. }