Builder::refresh()

If an instance already exists refresh the values by querying the same value against the DB.


Return

(TECEventsCustom_TablesV1ModelsModel)


Top ↑

Source

File: src/Events/Custom_Tables/V1/Models/Builder.php

	public function refresh() {
		$pk = $this->model->primary_key_name();
		if ( ! isset( $this->model->{$pk} ) ) {
			return $this->model;
		}

		$model = $this->find( $this->model->{$pk}, $pk );

		if ( $model === null ) {
			$this->model->reset();
		}

		foreach ( $model->to_array() as $column => $value ) {
			$this->model->{$column} = $value;
		}
	}

Top ↑

Changelog

Changelog
Version Description
6.1.3 Integration with memoization.
6.0.0 Introduced.