File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed
lib/Doctrine/ODM/MongoDB/Mapping/Driver
tests/Doctrine/ODM/MongoDB/Tests
Tools/Console/Command/Schema Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 13
13
*/
14
14
class AnnotationDriver extends AttributeDriver
15
15
{
16
+ /**
17
+ * The annotation reader.
18
+ *
19
+ * @internal this property will be private in 3.0
20
+ *
21
+ * @var Reader
22
+ */
23
+ protected $ reader ;
24
+
16
25
/**
17
26
* Initializes a new AnnotationDriver that uses the given AnnotationReader for reading
18
27
* docblock annotations.
@@ -22,7 +31,9 @@ class AnnotationDriver extends AttributeDriver
22
31
*/
23
32
public function __construct ($ reader , $ paths = null )
24
33
{
25
- parent ::__construct ($ paths , $ reader );
34
+ parent ::__construct ($ paths );
35
+
36
+ $ this ->reader = $ reader ;
26
37
}
27
38
28
39
/**
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class AttributeDriver implements MappingDriver
49
49
/** @param string|string[]|ClassLocator|null $paths */
50
50
public function __construct ($ paths = null , ?Reader $ reader = null )
51
51
{
52
- if ($ reader !== null && ! $ this instanceof AnnotationDriver ) {
52
+ if ($ reader !== null ) {
53
53
trigger_deprecation (
54
54
'doctrine/mongodb-odm ' ,
55
55
'2.7 ' ,
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function testFieldInheritance(): void
75
75
public function testLoadMetadataForNonDocumentThrowsException (): void
76
76
{
77
77
$ cm = new ClassMetadata ('stdClass ' );
78
- $ annotationDriver = AnnotationDriver:: create ();
78
+ $ annotationDriver = static :: loadDriver ();
79
79
80
80
$ this ->expectException (MappingException::class);
81
81
$ annotationDriver ->loadMetadataForClass ('stdClass ' , $ cm );
@@ -85,7 +85,7 @@ public function testLoadMetadataForNonDocumentThrowsException(): void
85
85
public function testColumnWithMissingTypeDefaultsToString (): void
86
86
{
87
87
$ cm = new ClassMetadata (ColumnWithoutType::class);
88
- $ annotationDriver = AnnotationDriver:: create ();
88
+ $ annotationDriver = static :: loadDriver ();
89
89
90
90
$ annotationDriver ->loadMetadataForClass (stdClass::class, $ cm );
91
91
self ::assertEquals ('id ' , $ cm ->fieldMappings ['id ' ]['type ' ]);
Original file line number Diff line number Diff line change 4
4
5
5
namespace Doctrine \ODM \MongoDB \Tests \Tools \Console \Command \Schema ;
6
6
7
- use Doctrine \ODM \MongoDB \Mapping \Driver \AnnotationDriver ;
7
+ use Doctrine \ODM \MongoDB \Mapping \Driver \AttributeDriver ;
8
8
use Doctrine \ODM \MongoDB \Tests \Tools \Console \Command \AbstractCommandTestCase ;
9
9
use Doctrine \ODM \MongoDB \Tools \Console \Command \Schema \UpdateCommand ;
10
10
use Doctrine \Persistence \Mapping \Driver \ClassNames ;
11
+ use Doctrine \Persistence \Mapping \Driver \MappingDriver ;
11
12
use Documents \Ecommerce ;
12
13
use Documents \SchemaValidated ;
13
14
use Symfony \Component \Console \Command \Command ;
@@ -88,7 +89,7 @@ public function testDisabledValidatorsProcessing(): void
88
89
self ::assertStringNotContainsString ('Updated validation for all classes ' , $ output );
89
90
}
90
91
91
- private function createDriver (): AnnotationDriver
92
+ private function createDriver (): MappingDriver
92
93
{
93
94
$ paths = [__DIR__ . '/../../../../../../../../Documents/Ecommerce ' ];
94
95
// Available in Doctrine Persistence 4.1+
@@ -104,6 +105,6 @@ private function createDriver(): AnnotationDriver
104
105
]);
105
106
}
106
107
107
- return AnnotationDriver ::create ($ paths );
108
+ return AttributeDriver ::create ($ paths );
108
109
}
109
110
}
You can’t perform that action at this time.
0 commit comments