Skip to content

Commit 31d7aef

Browse files
authored
Merge pull request #1895 from alcaeus/drop-simple-xml-references
Drop "simple" attribute from references in XML schema
2 parents af88c44 + ddcbb73 commit 31d7aef

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

doctrine-mongo-mapping.xsd

-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@
213213
<xs:attribute name="target-document" type="xs:string" />
214214
<xs:attribute name="field" type="xs:NMTOKEN" use="required" />
215215
<xs:attribute name="field-name" type="xs:NMTOKEN" />
216-
<xs:attribute name="simple" type="xs:boolean" /><!-- deprecated -->
217216
<xs:attribute name="store-as" type="odm:reference-store-as" default="dbRefWithDb" />
218217
<xs:attribute name="inversed-by" type="xs:NMTOKEN" />
219218
<xs:attribute name="mapped-by" type="xs:NMTOKEN" />
@@ -238,7 +237,6 @@
238237
<xs:attribute name="collection-class" type="xs:string" />
239238
<xs:attribute name="field" type="xs:NMTOKEN" use="required" />
240239
<xs:attribute name="field-name" type="xs:NMTOKEN" />
241-
<xs:attribute name="simple" type="xs:boolean" /><!-- deprecated -->
242240
<xs:attribute name="store-as" type="odm:reference-store-as" default="dbRefWithDb" />
243241
<xs:attribute name="strategy" type="xs:NMTOKEN" default="pushAll" />
244242
<xs:attribute name="inversed-by" type="xs:NMTOKEN" />

lib/Doctrine/ODM/MongoDB/Mapping/MappingException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ public static function cascadeOnEmbeddedNotAllowed(string $className, string $fi
116116

117117
public static function simpleReferenceRequiresTargetDocument(string $className, string $fieldName) : self
118118
{
119-
return new self(sprintf('Target document must be specified for simple reference: %s::%s', $className, $fieldName));
119+
return new self(sprintf('Target document must be specified for identifier reference: %s::%s', $className, $fieldName));
120120
}
121121

122122
public static function simpleReferenceMustNotTargetDiscriminatedDocument(string $targetDocument) : self
123123
{
124-
return new self(sprintf('Simple reference must not target document using Single Collection Inheritance, %s targeted.', $targetDocument));
124+
return new self(sprintf('Identifier reference must not target document using Single Collection Inheritance, %s targeted.', $targetDocument));
125125
}
126126

127127
public static function atomicCollectionStrategyNotAllowed(string $strategy, string $className, string $fieldName) : self

lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function primeReferences(ClassMetadata $class, $documents, string $fieldN
115115
* the priming query.
116116
*/
117117
if ($mapping['storeAs'] === ClassMetadata::REFERENCE_STORE_AS_ID && empty($mapping['targetDocument'])) {
118-
throw new LogicException(sprintf('Field "%s" is a simple reference without a target document class in class "%s"', $fieldName, $class->name));
118+
throw new LogicException(sprintf('Field "%s" is an identifier reference without a target document class in class "%s"', $fieldName, $class->name));
119119
}
120120

121121
if ($primer !== null && ! is_callable($primer)) {

tests/Doctrine/ODM/MongoDB/Tests/DocumentManagerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function testCreateDbRefWithNonNullEmptyId()
189189

190190
/**
191191
* @expectedException \Doctrine\ODM\MongoDB\Mapping\MappingException
192-
* @expectedExceptionMessage Simple reference must not target document using Single Collection Inheritance, Documents\Tournament\Participant targeted.
192+
* @expectedExceptionMessage Identifier reference must not target document using Single Collection Inheritance, Documents\Tournament\Participant targeted.
193193
*/
194194
public function testDisriminatedSimpleReferenceFails()
195195
{

tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public function testInvokeLifecycleCallbacksShouldAllowProxyOfExactClass()
465465

466466
/**
467467
* @expectedException \Doctrine\ODM\MongoDB\Mapping\MappingException
468-
* @expectedExceptionMessage Target document must be specified for simple reference: stdClass::assoc
468+
* @expectedExceptionMessage Target document must be specified for identifier reference: stdClass::assoc
469469
*/
470470
public function testSimpleReferenceRequiresTargetDocument()
471471
{
@@ -481,7 +481,7 @@ public function testSimpleReferenceRequiresTargetDocument()
481481

482482
/**
483483
* @expectedException \Doctrine\ODM\MongoDB\Mapping\MappingException
484-
* @expectedExceptionMessage Target document must be specified for simple reference: stdClass::assoc
484+
* @expectedExceptionMessage Target document must be specified for identifier reference: stdClass::assoc
485485
*/
486486
public function testSimpleAsStringReferenceRequiresTargetDocument()
487487
{
@@ -523,7 +523,7 @@ public function provideRepositoryMethodCanNotBeCombinedWithSkipLimitAndSort()
523523

524524
/**
525525
* @expectedException \Doctrine\ODM\MongoDB\Mapping\MappingException
526-
* @expectedExceptionMessage Target document must be specified for simple reference: stdClass::assoc
526+
* @expectedExceptionMessage Target document must be specified for identifier reference: stdClass::assoc
527527
*/
528528
public function testStoreAsIdReferenceRequiresTargetDocument()
529529
{

0 commit comments

Comments
 (0)