File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
1
# UPGRADE FROM 1.2 TO 1.3
2
2
3
+ ## Events
4
+
5
+ ### ` onClassMetadataNotFound ` event added
6
+
7
+ The default ClassMetadataFactory now triggers an ` onClassMetadataNotFound ` event
8
+ when no metadata was found for a given class. The event args contain information
9
+ about the loaded class and can store a metadata object which can be used to load
10
+ custom metadata when none was found.
11
+
12
+ ### ` ResolveTargetDocumentListener ` is now an event subscriber
13
+
14
+ The ` Doctrine\ODM\MongoDB\Tools\ResolveTargetDocumentListener ` class now
15
+ implements the ` EventSubscriber ` interface. You can still register it as a
16
+ listener as was necessary previously, but in order to use new functionality you
17
+ have to register it as an event subscriber.
18
+
19
+ ### ` ResolveTargetDocumentListener ` resolves class names on document load
20
+
21
+ The ` Doctrine\ODM\MongoDB\Tools\ResolveTargetDocumentListener ` class not only
22
+ resolves class names when looking up the ` targetDoccumet ` of an association in
23
+ a document, but it also uses the new ` onClassMetadataNotFound ` event to resolve
24
+ class names and trigger a secondary metadata load cycle if no metadata was found
25
+ for the original class name. To use this functionality, either register an event
26
+ listener for the ` onClassMetadataNotFound ` event or register the entire class as
27
+ an event subscriber.
28
+
3
29
## GridFS
4
30
5
31
GridFS support will be rewritten for 2.0 and was deprecated in its current form.
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ Doctrine MongoDB ODM includes a utility called
10
10
inside Doctrine and rewriting ``targetDocument `` parameters in your metadata
11
11
mapping at runtime. This allows your bundle to use an interface or abstract
12
12
class in its mappings while still allowing the mapping to resolve to a concrete
13
- document class at runtime.
13
+ document class at runtime. It will also rewrite class names when no mapping
14
+ metadata has been found for the original class name.
14
15
15
16
This functionality allows you to define relationships between different
16
17
documents without creating hard dependencies.
@@ -126,7 +127,7 @@ you cannot be guaranteed that the targetDocument resolution will occur reliably:
126
127
);
127
128
128
129
// Add the ResolveTargetDocumentListener
129
- $evm->addEventListener(\Doctrine\ODM\MongoDB\Events::loadClassMetadata, $rtdl);
130
+ $evm->addEventSubscriber( $rtdl);
130
131
131
132
// Create the document manager as you normally would
132
133
$dm = \Doctrine\ODM\MongoDB\DocumentManager::create($connectionOptions, $config, $evm);
You can’t perform that action at this time.
0 commit comments