PHP Класс WordPress\ORM\BaseModel

Автор: Brandon Wamboldt ([email protected])
Наследование: implements WordPress\ORM\ModelInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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