Code Duplication    Length = 16-18 lines in 2 locations

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

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