private function getChildNodename($parentId, $nodename, $child, $parent)
    {
        $childClass = $this->dm->getClassMetadata(get_class($child));
        if ($childClass->nodename && $childClass->reflFields[$childClass->nodename]->getValue($child)) {
            $nodename = $childClass->reflFields[$childClass->nodename]->getValue($child);

            if ($exception = $childClass->isValidNodename($nodename)) {
                throw IdException::illegalName($child, $childClass->nodename, $nodename);
            }
        } else {
            $childId = '';
            if ($childClass->identifier) {
                $childId = $childClass->getIdentifierValue($child);
            }
            if (!$childId) {
                $generator = $this->getIdGenerator($childClass->idGenerator);
                $childId = $generator->generate($child, $childClass, $this->dm, $parent);
            }

            if ('' !== $childId) {
                if ($childId !== $parentId.'/'.PathHelper::getNodeName($childId)) {
                    throw PHPCRException::cannotMoveByAssignment(self::objToStr($child, $this->dm));
                }
                $nodename = PathHelper::getNodeName($childId);
            }
        }

        return $nodename;
    }
private function getChildNodename($parentId, $nodename, $child, $parent)
    {
        $childClass = $this->dm->getClassMetadata(get_class($child));
        if ($childClass->nodename && $childClass->reflFields[$childClass->nodename]->getValue($child)) {
            $nodename = $childClass->reflFields[$childClass->nodename]->getValue($child);

            if ($exception = $childClass->isValidNodename($nodename)) {
                throw IdException::illegalName($child, $childClass->nodename, $nodename);
            }
        } else {
            $childId = '';
            if ($childClass->identifier) {
                $childId = $childClass->getIdentifierValue($child);
            }
            if (!$childId) {
                $generator = $this->getIdGenerator($childClass->idGenerator);
                $childId = $generator->generate($child, $childClass, $this->dm, $parent);
            }

            if ('' !== $childId) {
                if ($childId !== $parentId.'/'.PathHelper::getNodeName($childId)) {
                    throw PHPCRException::cannotMoveByAssignment(self::objToStr($child, $this->dm));
                }
                $nodename = PathHelper::getNodeName($childId);
            }
        }

        return $nodename;
    }
private function getChildNodename ( $ parentId , $ nodename , $ child , $ parent ) { $ childClass = $ this -> dm -> getClassMetadata ( get_class ( $ child ) ) ; if ( $ childClass -> nodename && $ childClass -> reflFields [ $ childClass -> nodename ] -> getValue ( $ child ) ) { $ nodename = $ childClass -> reflFields [ $ childClass -> nodename ] -> getValue ( $ child ) ; if ( $ exception = $ childClass -> isValidNodename ( $ nodename ) ) { throw IdException :: illegalName ( $ child , $ childClass -> nodename , $ nodename ) ; } } else { $ childId = '' ; if ( $ childClass -> identifier ) { $ childId = $ childClass -> getIdentifierValue ( $ child ) ; } if ( ! $ childId ) { $ generator = $ this -> getIdGenerator ( $ childClass -> idGenerator ) ; $ childId = $ generator -> generate ( $ child , $ childClass , $ this -> dm , $ parent ) ; } if ( '' !== $ childId ) { if ( $ childId !== $ parentId . '/' . PathHelper :: getNodeName ( $ childId ) ) { throw PHPCRException :: cannotMoveByAssignment ( self :: objToStr ( $ child , $ this -> dm ) ) ; } $ nodename = PathHelper :: getNodeName ( $ childId ) ; } } return $ nodename ; }
Determine the nodename of a child in a children list.

@param string $parentId Id of the parent document
@param string $nodename Name to use if we can't determine the node name otherwise.
@param object $child    The child document
@param object $parent   The parent document

@throws PHPCRException

@return mixed|string
Determine the nodename of a child in a children list .