Code Duplication    Length = 16-18 lines in 2 locations

bridge/doctrine-phpcr-odm/lib/PhpcrOdmAgent.php 2 locations

@@ 86-103 (lines=18) @@
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function getIdentifier($object)
87
    {
88
        $objectFqn = ClassUtils::getRealClass(get_class($object));
89
        $metadata = $this->documentManager->getClassMetadata($objectFqn);
90
        $uuidFieldName = $metadata->getUuidFieldName();
91
92
        if (!$uuidFieldName) {
93
            throw new \RuntimeException(sprintf(
94
                'Document "%s" does not have a UUID-mapped property. All '.
95
                'PHPCR-ODM documents must have a mapped UUID proprety.',
96
                $objectFqn
97
            ));
98
        }
99
100
        $node = $this->documentManager->getNodeForDocument($object);
101
102
        return $node->getIdentifier();
103
    }
104
105
    /**
106
     * {@inheritdoc}
@@ 108-123 (lines=16) @@
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function setParent($object, $parent)
109
    {
110
        $objectFqn = ClassUtils::getRealClass(get_class($object));
111
        $metadata = $this->documentManager->getClassMetadata($objectFqn);
112
        $parentField = $metadata->parentMapping;
113
114
        if (!$parentField) {
115
            throw new \RuntimeException(sprintf(
116
                'Document "%s" does not have a ParentDocument mapping All '.
117
                'PHPCR-ODM documents must have a mapped parent proprety.',
118
                $objectFqn
119
            ));
120
        }
121
122
        $metadata->setFieldValue($object, $parentField, $parent);
123
    }
124
125
    /**
126
     * {@inheritdoc}