Code Duplication    Length = 19-21 lines in 2 locations

src/SilverStripe/Elastica/Searchable.php 2 locations

@@ 206-224 (lines=19) @@
203
	}
204
205
206
	private function assignSpecForHasOne($resultType, &$spec) {
207
		$resultTypeInstance = \Injector::inst()->create($resultType);
208
209
		$resultTypeMapping = array();
210
211
		// get the fields for the result type, but do not recurse
212
		if($recurse) {
213
			$resultTypeMapping = $resultTypeInstance->getElasticaFields($storeMethodName, false);
214
		}
215
216
		$resultTypeMapping['ID'] = array('type' => 'integer');
217
218
		if($storeMethodName) {
219
			$resultTypeMapping['__method'] = $name;
220
		}
221
		$spec = array('properties' => $resultTypeMapping);
222
		// we now change the name to the result type, not the method name
223
		$name = $resultType;
224
	}
225
226
	private function assignSpecForManyRelationship($resultType, &$spec) {
227
		$resultTypeInstance = \Injector::inst()->create($resultType);
@@ 226-246 (lines=21) @@
223
		$name = $resultType;
224
	}
225
226
	private function assignSpecForManyRelationship($resultType, &$spec) {
227
		$resultTypeInstance = \Injector::inst()->create($resultType);
228
		$resultTypeMapping = array();
229
230
		// get the fields for the result type, but do not recurse
231
		if($recurse) {
232
			$resultTypeMapping = $resultTypeInstance->getElasticaFields($storeMethodName, false);
233
		}
234
235
		$resultTypeMapping['ID'] = array('type' => 'integer');
236
237
		if($storeMethodName) {
238
			$resultTypeMapping['__method'] = $name;
239
		}
240
241
		$spec = array('properties' => $resultTypeMapping);
242
243
244
		// we now change the name to the result type, not the method name
245
		$name = $resultType;
246
	}
247
248
249
	private function assignSpecForStandardFieldType($class, &$spec) {