Events.php 4.3KB

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