PHP 클래스 Granada\Granada

class Widget extends Model { }
상속: implements ArrayAcces\ArrayAccess
파일 보기 프로젝트 열기: surt/granada

공개 프로퍼티들

프로퍼티 타입 설명
$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