Model::__construct( $model_id )


Source

File: Model/Model.php

	public function __construct( $model_id = 0 ) {
		global $wpdb;

		$this->table = $wpdb->prefix . $this->table;

		if ( ! empty( $model_id ) ) {
			$model_raw = $wpdb->get_row( " SELECT * FROM {$this->table} WHERE {$this->primaryKey} = {$model_id}  ",
				ARRAY_A );
			if ( $model_raw ) {
				$this->syncModel( $model_raw );
			}
		}

	}