PHP 클래스 mtv\models\Model

You can access the fields on a model object in the following ways: $post->field_name; $post->attributes['field_name']; If you need an array of the fields on a model object, do this: $data = $post->attributes;
파일 보기 프로젝트 열기: newsapps/wordpress-mtv 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$attributes Where the model's data is stored
$cache_groups WP Object Cache groups this model is associated with
$collection
$defaults Default model data used when a new model is created
$editable_json_fields Attributes that can be updated over the wire
$json_fields Attributes that are OK to send over the wire

보호된 프로퍼티들

프로퍼티 타입 설명
$_previous_attributes Attributes that have been changed since the last save or fetch
$_synchronized Is this model's data sync'd with the DB?

공개 메소드들

메소드 설명
__construct ( $args = [] )
__get ( $name )
__isset ( $name )
__set ( $name, $val )
__toString ( )
__unset ( $name )
clear ( ) Delete all the attributes in this model
fetch ( ) Populate this model from permanent storage
from_json ( &$data ) Create a new model from json data sent over the wire
initialize ( $args ) Call initialize when the model is created
parse ( &$data ) Process the raw data from permanent storage
reload ( &$data ) Update this model with data from permanent storage
save ( ) Write the data in this model to permanent storage
set ( $args, $fetching = false ) Set a bunch of attributes at once
set_from_json ( &$data ) Update this model from json data sent over the wire
to_json ( ) Returns an assoc array of this model's data to send over the wire
validate ( ) Validate the data in this model
values ( ) Returns an array of selected values TODO: Return all values if no params are given

메소드 상세

__construct() 공개 메소드

public __construct ( $args = [] )

__get() 공개 메소드

public __get ( $name )

__isset() 공개 메소드

public __isset ( $name )

__set() 공개 메소드

public __set ( $name, $val )

__toString() 공개 메소드

public __toString ( )

__unset() 공개 메소드

public __unset ( $name )

clear() 공개 메소드

Delete all the attributes in this model
public clear ( )

fetch() 공개 메소드

Populate this model from permanent storage
public fetch ( )

from_json() 공개 정적인 메소드

Create a new model from json data sent over the wire
public static from_json ( &$data )

initialize() 공개 메소드

Call initialize when the model is created
public initialize ( $args )

parse() 공개 메소드

Process the raw data from permanent storage
public parse ( &$data )

reload() 공개 메소드

Update this model with data from permanent storage
public reload ( &$data )

save() 공개 메소드

Write the data in this model to permanent storage
public save ( )

set() 공개 메소드

Set a bunch of attributes at once
public set ( $args, $fetching = false )

set_from_json() 공개 메소드

Update this model from json data sent over the wire
public set_from_json ( &$data )

to_json() 공개 메소드

Returns an assoc array of this model's data to send over the wire
public to_json ( )

validate() 공개 메소드

Validate the data in this model
public validate ( )

values() 공개 메소드

Returns an array of selected values TODO: Return all values if no params are given
public values ( )

프로퍼티 상세

$_previous_attributes 보호되어 있는 프로퍼티

Attributes that have been changed since the last save or fetch
protected $_previous_attributes

$_synchronized 보호되어 있는 프로퍼티

Is this model's data sync'd with the DB?
protected $_synchronized

$attributes 공개적으로 프로퍼티

Where the model's data is stored
public $attributes

$cache_groups 공개적으로 프로퍼티

WP Object Cache groups this model is associated with
public $cache_groups

$collection 공개적으로 정적으로 프로퍼티

public static $collection

$defaults 공개적으로 프로퍼티

Default model data used when a new model is created
public $defaults

$editable_json_fields 공개적으로 프로퍼티

Attributes that can be updated over the wire
public $editable_json_fields

$json_fields 공개적으로 프로퍼티

Attributes that are OK to send over the wire
public $json_fields