@@ -16,26 +16,26 @@ class ParentIdGenerator extends IdGenerator
1616 *
1717 * {@inheritdoc}
1818 */
19- public function generate (object $ document , ClassMetadata $ class , DocumentManagerInterface $ dm , ?object $ parent = null ): string
19+ public function generate (object $ document , ClassMetadata $ metadata , DocumentManagerInterface $ dm , ?object $ parent = null ): string
2020 {
2121 if (null === $ parent ) {
22- $ parent = $ class ->parentMapping ? $ class ->getFieldValue ($ document , $ class ->parentMapping ) : null ;
22+ $ parent = $ metadata ->parentMapping ? $ metadata ->getFieldValue ($ document , $ metadata ->parentMapping ) : null ;
2323 }
2424
25- $ name = $ class ->nodename ? $ class ->getFieldValue ($ document , $ class ->nodename ) : null ;
26- $ id = $ class ->identifier ? $ class ->getFieldValue ($ document , $ class ->identifier ) : null ;
25+ $ name = $ metadata ->nodename ? $ metadata ->getFieldValue ($ document , $ metadata ->nodename ) : null ;
26+ $ id = $ metadata ->identifier ? $ metadata ->getFieldValue ($ document , $ metadata ->identifier ) : null ;
2727
2828 if (empty ($ id )) {
2929 if (empty ($ name ) && empty ($ parent )) {
30- throw IdException::noIdentificationParameters ($ document , $ class ->parentMapping , $ class ->nodename );
30+ throw IdException::noIdentificationParameters ($ document , $ metadata ->parentMapping , $ metadata ->nodename );
3131 }
3232
3333 if (empty ($ parent )) {
34- throw IdException::noIdNoParent ($ document , $ class ->parentMapping );
34+ throw IdException::noIdNoParent ($ document , $ metadata ->parentMapping );
3535 }
3636
3737 if (empty ($ name )) {
38- throw IdException::noIdNoName ($ document , $ class ->nodename );
38+ throw IdException::noIdNoName ($ document , $ metadata ->nodename );
3939 }
4040 }
4141
@@ -44,20 +44,20 @@ public function generate(object $document, ClassMetadata $class, DocumentManager
4444 return $ id ;
4545 }
4646
47- if ($ class ->isValidNodename ($ name )) {
48- throw IdException::illegalName ($ document , $ class ->nodename , $ name );
47+ if ($ metadata ->isValidNodename ($ name )) {
48+ throw IdException::illegalName ($ document , $ metadata ->nodename , $ name );
4949 }
5050
5151 // determine ID based on the path and the node name
52- return $ this ->buildName ($ document , $ class , $ dm , $ parent , $ name );
52+ return $ this ->buildName ($ document , $ metadata , $ dm , $ parent , $ name );
5353 }
5454
55- protected function buildName (object $ document , ClassMetadata $ class , DocumentManagerInterface $ dm , object $ parent , string $ name ): string
55+ protected function buildName (object $ document , ClassMetadata $ metadata , DocumentManagerInterface $ dm , object $ parent , string $ name ): string
5656 {
5757 // get the id of the parent document
5858 $ id = $ dm ->getUnitOfWork ()->getDocumentId ($ parent );
5959 if (!$ id ) {
60- throw IdException::parentIdCouldNotBeDetermined ($ document , $ class ->parentMapping , $ parent );
60+ throw IdException::parentIdCouldNotBeDetermined ($ document , $ metadata ->parentMapping , $ parent );
6161 }
6262
6363 // edge case parent is root
0 commit comments