protected function get_model_index( $pk ) {

		if ( isset( $this->pk_map[ $pk ] ) ) {
			return $this->pk_map[ $pk ];
		}

		foreach ( $this->elements as $i => $element ) {

			if ( $this->saver->get_pk( $element ) === $pk ) {

				$this->pk_map[ $pk ] = $i;

				return $i;
			}
		}

		return - 1;
	}
protected function get_model_index( $pk ) {

		if ( isset( $this->pk_map[ $pk ] ) ) {
			return $this->pk_map[ $pk ];
		}

		foreach ( $this->elements as $i => $element ) {

			if ( $this->saver->get_pk( $element ) === $pk ) {

				$this->pk_map[ $pk ] = $i;

				return $i;
			}
		}

		return - 1;
	}
protected function get_model_index ( $ pk ) { if ( isset ( $ this -> pk_map [ $ pk ] ) ) { return $ this -> pk_map [ $ pk ] ; } foreach ( $ this -> elements as $ i => $ element ) { if ( $ this -> saver -> get_pk ( $ element ) === $ pk ) { $ this -> pk_map [ $ pk ] = $ i ; return $ i ; } } return - 1 ; }
Get the index of a model.

@since 2.0

@param string|int $pk

@return int
Get the index of a model .