PHP 클래스 WordPress\ORM\BaseModel

저자: Brandon Wamboldt ([email protected])
상속: implements WordPress\ORM\ModelInterface
파일 보기 프로젝트 열기: brandonwamboldt/wp-orm 1 사용 예제들

공개 메소드들

메소드 설명
__call ( string $function, array $arguments ) : mixed Magically handle getters and setters.
__construct ( array $properties = [] ) Constructor.
all ( ) : array Return EVERY instance of this model from the database, with NO filtering.
create ( $properties ) : self Create a new model from the given data.
delete ( ) : boolean Delete the model from the database. Returns true if it was successful or false if it was not.
find_one ( integer $id ) : false | self Find a specific model by it's unique ID.
find_one_by ( string $property, string $value ) : false | self Find a specific model by a given property value.
flatten_props ( array $props ) : array Convert complex objects to strings to insert into the database.
get_primary_key ( ) : string Get the column used as the primary key, defaults to 'id'.
get_table_prefix ( ) : string Return configured table prefix.
primary_key ( ) : integer Return the value of the primary key.
properties ( ) : array Return an array of all the properties for this model. By default, returns every class variable.
query ( ) : Query Start a query to find models matching specific criteria.
save ( ) : integer Save this model to the database. Will create a new record if the ID property isn't set, or update an existing record if the ID property is set.
to_array ( ) : array Get all of the properties of this model as an array.

메소드 상세

__call() 공개 메소드

Magically handle getters and setters.
public __call ( string $function, array $arguments ) : mixed
$function string
$arguments array
리턴 mixed

__construct() 공개 메소드

Constructor.
public __construct ( array $properties = [] )
$properties array

all() 공개 정적인 메소드

Return EVERY instance of this model from the database, with NO filtering.
public static all ( ) : array
리턴 array

create() 공개 정적인 메소드

Create a new model from the given data.
public static create ( $properties ) : self
리턴 self

delete() 공개 메소드

Delete the model from the database. Returns true if it was successful or false if it was not.
public delete ( ) : boolean
리턴 boolean

find_one() 공개 정적인 메소드

Find a specific model by it's unique ID.
public static find_one ( integer $id ) : false | self
$id integer
리턴 false | self

find_one_by() 공개 정적인 메소드

Find a specific model by a given property value.
public static find_one_by ( string $property, string $value ) : false | self
$property string
$value string
리턴 false | self

flatten_props() 공개 메소드

Convert complex objects to strings to insert into the database.
public flatten_props ( array $props ) : array
$props array
리턴 array

get_primary_key() 공개 정적인 메소드

Get the column used as the primary key, defaults to 'id'.
public static get_primary_key ( ) : string
리턴 string

get_table_prefix() 공개 메소드

Return configured table prefix.
public get_table_prefix ( ) : string
리턴 string

primary_key() 공개 메소드

Return the value of the primary key.
public primary_key ( ) : integer
리턴 integer

properties() 공개 메소드

Return an array of all the properties for this model. By default, returns every class variable.
public properties ( ) : array
리턴 array

query() 공개 정적인 메소드

Start a query to find models matching specific criteria.
public static query ( ) : Query
리턴 Query

save() 공개 메소드

Save this model to the database. Will create a new record if the ID property isn't set, or update an existing record if the ID property is set.
public save ( ) : integer
리턴 integer

to_array() 공개 메소드

Get all of the properties of this model as an array.
public to_array ( ) : array
리턴 array