@@ -257,6 +257,13 @@ class ClassMetadata implements ClassMetadataInterface
257257 */
258258 public $ localeMapping ;
259259
260+ /**
261+ * READ-ONLY: Name of the depth property
262+ *
263+ * @var string
264+ */
265+ public $ depthMapping ;
266+
260267 /**
261268 * READ-ONLY: Name of the version name property of this document
262269 *
@@ -767,6 +774,13 @@ public function mapLocale(array $mapping, ClassMetadata $inherited = null)
767774 $ this ->localeMapping = $ mapping ['fieldName ' ];
768775 }
769776
777+ public function mapDepth (array $ mapping , ClassMetadata $ inherited = null )
778+ {
779+ $ mapping ['type ' ] = 'depth ' ;
780+ $ mapping = $ this ->validateAndCompleteFieldMapping ($ mapping , $ inherited , false , false );
781+ $ this ->depthMapping = $ mapping ['fieldName ' ];
782+ }
783+
770784 public function mapVersionName (array $ mapping , ClassMetadata $ inherited = null )
771785 {
772786 $ mapping ['type ' ] = 'versionname ' ;
@@ -1118,6 +1132,7 @@ public function hasField($fieldName)
11181132 || isset ($ this ->inheritedFields [$ fieldName ])
11191133 || $ this ->identifier === $ fieldName
11201134 || $ this ->localeMapping === $ fieldName
1135+ || $ this ->depthMapping === $ fieldName
11211136 || $ this ->node === $ fieldName
11221137 || $ this ->nodename === $ fieldName
11231138 || $ this ->versionNameField === $ fieldName
@@ -1196,6 +1211,9 @@ public function getFieldNames()
11961211 if ($ this ->localeMapping ) {
11971212 $ fields [] = $ this ->localeMapping ;
11981213 }
1214+ if ($ this ->depthMapping ) {
1215+ $ fields [] = $ this ->depthMapping ;
1216+ }
11991217 if ($ this ->node ) {
12001218 $ fields [] = $ this ->node ;
12011219 }
@@ -1448,6 +1466,10 @@ public function __sleep()
14481466 $ serialized [] = 'localeMapping ' ;
14491467 }
14501468
1469+ if ($ this ->depthMapping ) {
1470+ $ serialized [] = 'depthMapping ' ;
1471+ }
1472+
14511473 if ($ this ->translator ) {
14521474 $ serialized [] = 'translator ' ;
14531475 }
0 commit comments