PHP Класс Granada\Granada

class Widget extends Model { }
Наследование: implements ArrayAcces\ArrayAccess
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$auto_prefix_models string Set a prefix for model names. This can be a namespace or any other abitrary prefix such as the PEAR naming convention.
$orm The ORM instance used by this model instance to communicate with the database.
$relating string The relationship type the model is currently resolving.
$relating_key string The foreign key of the "relating" relationship.
$relating_table string This is used during has_many_through eager loading.
$relationships array $relationships attributes will not be saved to the database, and are primarily used to hold relationships. __set and __get need the relationship method defined on the model to determine if the relationship exists.
$resultSetClass

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

Метод Описание
__callStatic ( $method, $parameters ) Calls static methods directly on the Orm\Wrapper
__get ( $property ) Magic getter method, allows $model->property access to data.
__isset ( $property ) Magic isset method, allows isset($model->property) to work correctly.
__set ( $property, $value ) Magic setter method, allows $model->property = 'value' access to data.
as_array ( ) Wrapper for Idiorm's as_array method.
delete ( ) Delete the database row associated with this model instance.
factory ( $class_name, $connection_name = null ) Factory method used to acquire instances of the given class.
get ( $property ) Getter method, allows $model->get('property') access to data
get_resultSetClass ( )
hydrate ( $data ) Hydrate this model instance with an associative array of data.
id ( ) Get the database ID of this model instance.
is_dirty ( $property ) Check whether the given field has changed since the object was created or saved
is_new ( ) : boolean Check whether the model was the result of a call to create() or not
list_dirty_fields ( ) Get the list of fields that need updating on next save
offsetExists ( integer | string $offset ) : boolean ArrayAccess
offsetGet ( integer | string $offset ) : mixed ArrayAccess
offsetSet ( integer | string $offset, mixed $value ) ArrayAccess
offsetUnset ( integer | string $offset ) ArrayAccess
save ( $ignore = false ) Save the data associated with this model instance to the database.
set ( $property, string | null $value = null ) Setter method, allows $model->set('property', 'value') access to data.
set_expr ( $property, string | null $value = null ) Setter method, allows $model->set_expr('property', 'value') access to data.
set_orm ( $orm ) Set the wrapped ORM instance associated with this Model instance.

Защищенные методы

Метод Описание
_build_foreign_key_name ( $specified_foreign_key_name, $table_name ) Build a foreign key based on a table name. If the first argument (the specified foreign key column name) is null, returns the second argument (the name of the table) with the default foreign key column suffix appended.
_class_name_to_table_name ( $class_name ) Convert a namespace to the standard PEAR underscore format.
_get_id_column_name ( string $class_name ) Return the ID column name to use for this class. If it is not set on the class, returns null.
_get_static_property ( $class_name, string $property, $default = null ) Retrieve the value of a static property on a class. If the class or the property does not exist, returns the default value supplied as the third argument (which defaults to null).
_get_table_name ( string $class_name ) Static method to get a table name given a class name.
_has_one_or_many ( $associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null ) Internal method to construct the queries for both the has_one and has_many methods. These two types of association are identical; the only difference is whether find_one or find_many is used to complete the method chain.
belongs_to ( string $associated_class_name, string $foreign_key_name = null, $foreign_key_name_in_associated_models_table = null, $connection_name = null ) Helper method to manage one-to-one and one-to-many relations where the foreign key is on the base table.
has_many ( string $associated_class_name, string $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null ) Helper method to manage one-to-many relations where the foreign key is on the associated table.
has_many_through ( string $associated_class_name, string $join_class_name = null, string $key_to_base_table = null, string $key_to_associated_table = null, $key_in_base_table = null, $key_in_associated_table = null, $connection_name = null ) Helper method to manage many-to-many relationships via an intermediate model. See README for a full explanation of the parameters.
has_one ( string $associated_class_name, string $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null ) Helper method to manage one-to-one relations where the foreign key is on the associated table.

Описание методов

__callStatic() публичный статический Метод

Calls static methods directly on the Orm\Wrapper
public static __callStatic ( $method, $parameters )

__get() публичный Метод

Added: check for get_{property_name} method defined in model and not null missing_{property_name} method is null or undefined in model fetched relationships not loaded relationship. "lazy load" if method exists
public __get ( $property )

__isset() публичный Метод

Magic isset method, allows isset($model->property) to work correctly.
public __isset ( $property )

__set() публичный Метод

Added: use Model methods to determine if a relationship exists and populate it on $relationships instead of properties
public __set ( $property, $value )

_build_foreign_key_name() защищенный статический Метод

Build a foreign key based on a table name. If the first argument (the specified foreign key column name) is null, returns the second argument (the name of the table) with the default foreign key column suffix appended.
protected static _build_foreign_key_name ( $specified_foreign_key_name, $table_name )

_class_name_to_table_name() защищенный статический Метод

Then convert a class name in CapWords to a table name in lowercase_with_underscores. Finally strip doubled up underscores For example, CarTyre would be converted to car_tyre. And Project\Models\CarTyre would be project_models_car_tyre.
protected static _class_name_to_table_name ( $class_name )

_get_id_column_name() защищенный статический Метод

Return the ID column name to use for this class. If it is not set on the class, returns null.
protected static _get_id_column_name ( string $class_name )
$class_name string

_get_static_property() защищенный статический Метод

Retrieve the value of a static property on a class. If the class or the property does not exist, returns the default value supplied as the third argument (which defaults to null).
protected static _get_static_property ( $class_name, string $property, $default = null )
$property string

_get_table_name() защищенный статический Метод

If the supplied class has a public static property named $_table, the value of this property will be returned. If not, the class name will be converted using the _class_name_to_table_name method method.
protected static _get_table_name ( string $class_name )
$class_name string

_has_one_or_many() защищенный Метод

Internal method to construct the queries for both the has_one and has_many methods. These two types of association are identical; the only difference is whether find_one or find_many is used to complete the method chain.
protected _has_one_or_many ( $associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null )

as_array() публичный Метод

Wrapper for Idiorm's as_array method.
public as_array ( )

belongs_to() защищенный Метод

Helper method to manage one-to-one and one-to-many relations where the foreign key is on the base table.
protected belongs_to ( string $associated_class_name, string $foreign_key_name = null, $foreign_key_name_in_associated_models_table = null, $connection_name = null )
$associated_class_name string
$foreign_key_name string

delete() публичный Метод

Delete the database row associated with this model instance.
public delete ( )

factory() публичный статический Метод

The class name should be supplied as a string, and the class should already have been loaded by PHP (or a suitable autoloader should exist). This method actually returns a wrapped ORM object which allows a database query to be built. The wrapped ORM object is responsible for returning instances of the correct class when its find_one or find_many methods are called.
public static factory ( $class_name, $connection_name = null )

get() публичный Метод

Getter method, allows $model->get('property') access to data
public get ( $property )

get_resultSetClass() публичный Метод

public get_resultSetClass ( )

has_many() защищенный Метод

Helper method to manage one-to-many relations where the foreign key is on the associated table.
protected has_many ( string $associated_class_name, string $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null )
$associated_class_name string
$foreign_key_name string

has_many_through() защищенный Метод

Helper method to manage many-to-many relationships via an intermediate model. See README for a full explanation of the parameters.
protected has_many_through ( string $associated_class_name, string $join_class_name = null, string $key_to_base_table = null, string $key_to_associated_table = null, $key_in_base_table = null, $key_in_associated_table = null, $connection_name = null )
$associated_class_name string
$join_class_name string
$key_to_base_table string
$key_to_associated_table string

has_one() защищенный Метод

Helper method to manage one-to-one relations where the foreign key is on the associated table.
protected has_one ( string $associated_class_name, string $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null )
$associated_class_name string
$foreign_key_name string

hydrate() публичный Метод

WARNING: The keys in the array MUST match with columns in the corresponding database table. If any keys are supplied which do not match up with columns, the database will throw an error.
public hydrate ( $data )

id() публичный Метод

Get the database ID of this model instance.
public id ( )

is_dirty() публичный Метод

Check whether the given field has changed since the object was created or saved
public is_dirty ( $property )

is_new() публичный Метод

Check whether the model was the result of a call to create() or not
public is_new ( ) : boolean
Результат boolean

list_dirty_fields() публичный Метод

Get the list of fields that need updating on next save
public list_dirty_fields ( )

offsetExists() публичный Метод

ArrayAccess
public offsetExists ( integer | string $offset ) : boolean
$offset integer | string
Результат boolean

offsetGet() публичный Метод

ArrayAccess
public offsetGet ( integer | string $offset ) : mixed
$offset integer | string
Результат mixed

offsetSet() публичный Метод

ArrayAccess
public offsetSet ( integer | string $offset, mixed $value )
$offset integer | string
$value mixed

offsetUnset() публичный Метод

ArrayAccess
public offsetUnset ( integer | string $offset )
$offset integer | string

save() публичный Метод

Save the data associated with this model instance to the database.
public save ( $ignore = false )

set() публичный Метод

Setter method, allows $model->set('property', 'value') access to data.
public set ( $property, string | null $value = null )
$value string | null

set_expr() публичный Метод

Setter method, allows $model->set_expr('property', 'value') access to data.
public set_expr ( $property, string | null $value = null )
$value string | null

set_orm() публичный Метод

Set the wrapped ORM instance associated with this Model instance.
public set_orm ( $orm )

Описание свойств

$auto_prefix_models публичное статическое свойство

Set a prefix for model names. This can be a namespace or any other abitrary prefix such as the PEAR naming convention.
public static string $auto_prefix_models
Результат string

$orm публичное свойство

The ORM instance used by this model instance to communicate with the database.
public $orm

$relating публичное свойство

The relationship type the model is currently resolving.
public string $relating
Результат string

$relating_key публичное свойство

The foreign key of the "relating" relationship.
public string $relating_key
Результат string

$relating_table публичное свойство

This is used during has_many_through eager loading.
public string $relating_table
Результат string

$relationships публичное свойство

$relationships attributes will not be saved to the database, and are primarily used to hold relationships. __set and __get need the relationship method defined on the model to determine if the relationship exists.
public array $relationships
Результат array

$resultSetClass публичное статическое свойство

public static $resultSetClass