Code Duplication    Length = 16-18 lines in 2 locations

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

@@ 59-76 (lines=18) @@
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getIdentifier($object)
60
    {
61
        $objectFqn = ClassUtils::getRealClass(get_class($object));
62
        $metadata = $this->documentManager->getClassMetadata($objectFqn);
63
        $uuidFieldName = $metadata->getUuidFieldName();
64
65
        if (!$uuidFieldName) {
66
            throw new \RuntimeException(sprintf(
67
                'Document "%s" does not have a UUID-mapped property. All '.
68
                'PHPCR-ODM documents must have a mapped UUID proprety.',
69
                $objectFqn
70
            ));
71
        }
72
73
        $node = $this->documentManager->getNodeForDocument($object);
74
75
        return $node->getIdentifier();
76
    }
77
78
    /**
79
     * {@inheritdoc}
@@ 81-96 (lines=16) @@
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function setParent($object, $parent)
82
    {
83
        $objectFqn = ClassUtils::getRealClass(get_class($object));
84
        $metadata = $this->documentManager->getClassMetadata($objectFqn);
85
        $parentField = $metadata->parentMapping;
86
87
        if (!$parentField) {
88
            throw new \RuntimeException(sprintf(
89
                'Document "%s" does not have a ParentDocument mapping All '.
90
                'PHPCR-ODM documents must have a mapped parent proprety.',
91
                $objectFqn
92
            ));
93
        }
94
95
        $metadata->setFieldValue($object, $parentField, $parent);
96
    }
97
98
    /**
99
     * {@inheritdoc}