@@ -256,6 +256,13 @@ class ClassMetadata implements ClassMetadataInterface
256256 */
257257 public $ localeMapping ;
258258
259+ /**
260+ * READ-ONLY: Name of the depth property
261+ *
262+ * @var string
263+ */
264+ public $ depthMapping ;
265+
259266 /**
260267 * READ-ONLY: Name of the version name property of this document
261268 *
@@ -766,6 +773,13 @@ public function mapLocale(array $mapping, ClassMetadata $inherited = null)
766773 $ this ->localeMapping = $ mapping ['fieldName ' ];
767774 }
768775
776+ public function mapDepth (array $ mapping , ClassMetadata $ inherited = null )
777+ {
778+ $ mapping ['type ' ] = 'depth ' ;
779+ $ mapping = $ this ->validateAndCompleteFieldMapping ($ mapping , $ inherited , false , false );
780+ $ this ->depthMapping = $ mapping ['fieldName ' ];
781+ }
782+
769783 public function mapVersionName (array $ mapping , ClassMetadata $ inherited = null )
770784 {
771785 $ mapping ['type ' ] = 'versionname ' ;
@@ -1117,6 +1131,7 @@ public function hasField($fieldName)
11171131 || isset ($ this ->inheritedFields [$ fieldName ])
11181132 || $ this ->identifier === $ fieldName
11191133 || $ this ->localeMapping === $ fieldName
1134+ || $ this ->depthMapping === $ fieldName
11201135 || $ this ->node === $ fieldName
11211136 || $ this ->nodename === $ fieldName
11221137 || $ this ->versionNameField === $ fieldName
@@ -1198,6 +1213,9 @@ public function getFieldNames()
11981213 if ($ this ->localeMapping ) {
11991214 $ fields [] = $ this ->localeMapping ;
12001215 }
1216+ if ($ this ->depthMapping ) {
1217+ $ fields [] = $ this ->depthMapping ;
1218+ }
12011219 if ($ this ->node ) {
12021220 $ fields [] = $ this ->node ;
12031221 }
@@ -1450,6 +1468,10 @@ public function __sleep()
14501468 $ serialized [] = 'localeMapping ' ;
14511469 }
14521470
1471+ if ($ this ->depthMapping ) {
1472+ $ serialized [] = 'depthMapping ' ;
1473+ }
1474+
14531475 if ($ this ->translator ) {
14541476 $ serialized [] = 'translator ' ;
14551477 }
0 commit comments