Code Duplication    Length = 7-7 lines in 2 locations

model/DataObject.php 2 locations

@@ 1614-1620 (lines=7) @@
1611
		}
1612
1613
		// If we haven't been written yet, we can't save these relations, so use a list that handles this case
1614
		if(!$this->ID) {
1615
			if(!isset($this->unsavedRelations[$componentName])) {
1616
				$this->unsavedRelations[$componentName] =
1617
					new UnsavedRelationList($this->class, $componentName, $componentClass);
1618
			}
1619
			return $this->unsavedRelations[$componentName];
1620
		}
1621
1622
		// Determine type and nature of foreign relation
1623
		$joinField = $this->getRemoteJoinField($componentName, 'has_many', $polymorphic);
@@ 1778-1784 (lines=7) @@
1775
		}
1776
1777
		// If we haven't been written yet, we can't save these relations, so use a list that handles this case
1778
		if(!$this->ID) {
1779
			if(!isset($this->unsavedRelations[$componentName])) {
1780
				$this->unsavedRelations[$componentName] =
1781
					new UnsavedRelationList($parentClass, $componentName, $componentClass);
1782
			}
1783
			return $this->unsavedRelations[$componentName];
1784
		}
1785
1786
		$extraFields = $this->manyManyExtraFieldsForComponent($componentName) ?: array();
1787
		$result = ManyManyList::create($componentClass, $table, $componentField, $parentField, $extraFields);