Code Duplication    Length = 5-7 lines in 2 locations

lib/Cake/Model/Model.php 1 location

@@ 1949-1955 (lines=7) @@
1946
					}
1947
1948
					$newData[] = $row;
1949
				} elseif (isset($row[$join]) && isset($row[$join][$habtm['associationForeignKey']])) {
1950
					if (!empty($row[$join][$Model->primaryKey])) {
1951
						$newJoins[] = $row[$join][$habtm['associationForeignKey']];
1952
					}
1953
1954
					$newData[] = $row[$join];
1955
				}
1956
			}
1957
1958
			$keepExisting = $habtm['unique'] === 'keepExisting';

lib/Cake/Model/ModelValidator.php 1 location

@@ 432-436 (lines=5) @@
429
430
			$newData = array();
431
			foreach ((array)$data as $row) {
432
				if (isset($row[$model->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
433
					$newData[] = $row;
434
				} elseif (isset($row[$join]) && isset($row[$join][$model->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
435
					$newData[] = $row[$join];
436
				}
437
			}
438
			foreach ($newData as $data) {
439
				$data[$model->hasAndBelongsToMany[$assoc]['foreignKey']] = $model->id;