Code Duplication    Length = 9-9 lines in 2 locations

core/db_models/EEM_CPT_Base.model.php 2 locations

@@ 385-393 (lines=9) @@
382
		$post = (array)$post;
383
		$has_all_necessary_fields_for_table = true;
384
		//check if the post has fields on the meta table already
385
		foreach($this->_get_other_tables() as $table_obj){
386
			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
387
			foreach($fields_for_that_table as $field_obj){
388
				if( ! isset($post[$field_obj->get_table_column()])
389
					&& ! isset($post[$field_obj->get_qualified_column()])){
390
					$has_all_necessary_fields_for_table = false;
391
				}
392
			}
393
		}
394
		//if we don't have all the fields we need, then just fetch the proper model from the DB
395
		if( ! $has_all_necessary_fields_for_table){
396
@@ 416-424 (lines=9) @@
413
		$post = (array)$post;
414
		$tables_needing_to_be_queried = array();
415
		//check if the post has fields on the meta table already
416
		foreach($this->get_tables() as $table_obj){
417
			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
418
			foreach($fields_for_that_table as $field_obj){
419
				if( ! isset($post[$field_obj->get_table_column()])
420
					&& ! isset($post[$field_obj->get_qualified_column()])){
421
					$tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj;
422
				}
423
			}
424
		}
425
		//if we don't have all the fields we need, then just fetch the proper model from the DB
426
		if( $tables_needing_to_be_queried){
427
			if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){