protected function build_eager_load_map( $models ) {

		$map = array();

		$foreign = $this->foreign_key;

		foreach ( $models as $model ) {
			$pk = $model->get_raw_attribute( $foreign );

			if ( $pk instanceof Model ) {
				$pk = $pk->get_pk();
			}

			$map[ $pk ][ $model->get_pk() ] = $model;
		}

		return $map;
	}
protected function build_eager_load_map( $models ) {

		$map = array();

		$foreign = $this->foreign_key;

		foreach ( $models as $model ) {
			$pk = $model->get_raw_attribute( $foreign );

			if ( $pk instanceof Model ) {
				$pk = $pk->get_pk();
			}

			$map[ $pk ][ $model->get_pk() ] = $model;
		}

		return $map;
	}
protected function build_eager_load_map ( $ models ) { $ map = array ( ) ; $ foreign = $ this -> foreign_key ; foreach ( $ models as $ model ) { $ pk = $ model -> get_raw_attribute ( $ foreign ) ; if ( $ pk instanceof Model ) { $ pk = $ pk -> get_pk ( ) ; } $ map [ $ pk ] [ $ model -> get_pk ( ) ] = $ model ; } return $ map ; }
Build an eager load map.

@since 2.0

@param Collection $models

@return array
Build an eager load map .