|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\ODM\MongoDB; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Container for all ODM events. |
|
9
|
|
|
* |
|
10
|
|
|
* This class cannot be instantiated. |
|
11
|
|
|
*/ |
|
12
|
|
|
final class Events |
|
13
|
|
|
{ |
|
14
|
|
|
private function __construct() |
|
15
|
|
|
{ |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* The preRemove event occurs for a given document before the respective |
|
20
|
|
|
* DocumentManager remove operation for that document is executed. |
|
21
|
|
|
* |
|
22
|
|
|
* This is a document lifecycle event. |
|
23
|
|
|
*/ |
|
24
|
|
|
public const preRemove = 'preRemove'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* The postRemove event occurs for a document after the document has |
|
28
|
|
|
* been deleted. It will be invoked after the database delete operations. |
|
29
|
|
|
* |
|
30
|
|
|
* This is a document lifecycle event. |
|
31
|
|
|
*/ |
|
32
|
|
|
public const postRemove = 'postRemove'; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* The prePersist event occurs for a given document before the respective |
|
36
|
|
|
* DocumentManager persist operation for that document is executed. |
|
37
|
|
|
* |
|
38
|
|
|
* This is a document lifecycle event. |
|
39
|
|
|
*/ |
|
40
|
|
|
public const prePersist = 'prePersist'; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* The postPersist event occurs for a document after the document has |
|
44
|
|
|
* been made persistent. It will be invoked after the database insert operations. |
|
45
|
|
|
* Generated primary key values are available in the postPersist event. |
|
46
|
|
|
* |
|
47
|
|
|
* This is a document lifecycle event. |
|
48
|
|
|
*/ |
|
49
|
|
|
public const postPersist = 'postPersist'; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* The preUpdate event occurs before the database update operations to |
|
53
|
|
|
* document data. |
|
54
|
|
|
* |
|
55
|
|
|
* This is a document lifecycle event. |
|
56
|
|
|
*/ |
|
57
|
|
|
public const preUpdate = 'preUpdate'; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* The postUpdate event occurs after the database update operations to |
|
61
|
|
|
* document data. |
|
62
|
|
|
* |
|
63
|
|
|
* This is a document lifecycle event. |
|
64
|
|
|
*/ |
|
65
|
|
|
public const postUpdate = 'postUpdate'; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* The preLoad event occurs for a document before the document has been loaded |
|
69
|
|
|
* into the current DocumentManager from the database or before the refresh operation |
|
70
|
|
|
* has been applied to it. |
|
71
|
|
|
* |
|
72
|
|
|
* This is a document lifecycle event. |
|
73
|
|
|
*/ |
|
74
|
|
|
public const preLoad = 'preLoad'; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* The postLoad event occurs for a document after the document has been loaded |
|
78
|
|
|
* into the current DocumentManager from the database or after the refresh operation |
|
79
|
|
|
* has been applied to it. |
|
80
|
|
|
* |
|
81
|
|
|
* Note that the postLoad event occurs for a document 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 a document lifecycle event. |
|
86
|
|
|
*/ |
|
87
|
|
|
public const postLoad = 'postLoad'; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* The loadClassMetadata event occurs after the mapping metadata for a class |
|
91
|
|
|
* has been loaded from a mapping source (annotations/xml). |
|
92
|
|
|
*/ |
|
93
|
|
|
public const loadClassMetadata = 'loadClassMetadata'; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* The onClassMetadataNotFound event occurs whenever loading metadata for a class |
|
97
|
|
|
* failed. |
|
98
|
|
|
*/ |
|
99
|
|
|
public const onClassMetadataNotFound = 'onClassMetadataNotFound'; |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* The preFlush event occurs when the DocumentManager#flush() operation is invoked, |
|
103
|
|
|
* but before any changes to managed documents have been calculated. This event is |
|
104
|
|
|
* always raised right after DocumentManager#flush() call. |
|
105
|
|
|
*/ |
|
106
|
|
|
public const preFlush = 'preFlush'; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* The onFlush event occurs when the DocumentManager#flush() operation is invoked, |
|
110
|
|
|
* after any changes to managed documents have been determined but before any |
|
111
|
|
|
* actual database operations are executed. The event is only raised if there is |
|
112
|
|
|
* actually something to do for the underlying UnitOfWork. If nothing needs to be done, |
|
113
|
|
|
* the onFlush event is not raised. |
|
114
|
|
|
*/ |
|
115
|
|
|
public const onFlush = 'onFlush'; |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* The postFlush event occurs when the DocumentManager#flush() operation is invoked and |
|
119
|
|
|
* after all actual database operations are executed successfully. The event is only raised if there is |
|
120
|
|
|
* actually something to do for the underlying UnitOfWork. If nothing needs to be done, |
|
121
|
|
|
* the postFlush event is not raised. The event won't be raised if an error occurs during the |
|
122
|
|
|
* flush operation. |
|
123
|
|
|
*/ |
|
124
|
|
|
public const postFlush = 'postFlush'; |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* The onClear event occurs when the DocumentManager#clear() operation is invoked, |
|
128
|
|
|
* after all references to documents have been removed from the unit of work. |
|
129
|
|
|
*/ |
|
130
|
|
|
public const onClear = 'onClear'; |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* The documentNotFound event occurs if a proxy object could not be found in |
|
134
|
|
|
* the database. |
|
135
|
|
|
*/ |
|
136
|
|
|
public const documentNotFound = 'documentNotFound'; |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* The postCollectionLoad event occurs after collection is initialized (loaded). |
|
140
|
|
|
*/ |
|
141
|
|
|
public const postCollectionLoad = 'postCollectionLoad'; |
|
142
|
|
|
} |
|
143
|
|
|
|