Code Duplication    Length = 7-7 lines in 2 locations

src/ORM/DataObject.php 2 locations

@@ 1596-1602 (lines=7) @@
1593
        }
1594
1595
        // If we haven't been written yet, we can't save these relations, so use a list that handles this case
1596
        if (!$this->ID) {
1597
            if (!isset($this->unsavedRelations[$componentName])) {
1598
                $this->unsavedRelations[$componentName] =
1599
                    new UnsavedRelationList($this->class, $componentName, $componentClass);
1600
            }
1601
            return $this->unsavedRelations[$componentName];
1602
        }
1603
1604
        // Determine type and nature of foreign relation
1605
        $joinField = $schema->getRemoteJoinField(static::class, $componentName, 'has_many', $polymorphic);
@@ 1827-1833 (lines=7) @@
1824
            = $manyManyComponent;
1825
1826
        // If we haven't been written yet, we can't save these relations, so use a list that handles this case
1827
        if (!$this->ID) {
1828
            if (!isset($this->unsavedRelations[$componentName])) {
1829
                $this->unsavedRelations[$componentName] =
1830
                    new UnsavedRelationList($parentClass, $componentName, $componentClass);
1831
            }
1832
            return $this->unsavedRelations[$componentName];
1833
        }
1834
1835
        $extraFields = $schema->manyManyExtraFieldsForComponent(static::class, $componentName) ?: array();
1836
        /** @var RelationList $result */