Events.php 5.0 KB

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