PHP 클래스 Granada\Orm\Wrapper

You shouldn't need to interact with this class directly. It is used internally by the Model base class.
상속: extends Granada\ORM
파일 보기 프로젝트 열기: surt/granada 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$relationships

보호된 프로퍼티들

프로퍼티 타입 설명
$_class_name The wrapped find_one and find_many classes will return an instance or instances of this class.

공개 메소드들

메소드 설명
__call ( $method, $parameters ) Overrides __call to check for filter_$method names defined You can now define filters methods on the Granada Model as public static function filter_{filtermethodname} and call it from a static call ModelName::filtermethodname->.
assoc_to_keyval ( $assoc = null, boolean | string $key_field = null, boolean | string $val_field = null ) : array Converts a multi-dimensional associative array into an array of key => values with the provided field names
create ( $data = null ) Wrap Idiorm's create method to return an empty instance of the class associated with this wrapper instead of the raw ORM class.
filter ( ) Add a custom filter to the method chain specified on the model class. This allows custom queries to be added to models. The filter should take an instance of the ORM wrapper as its first argument and return an instance of the ORM wrapper. Any arguments passed to this method after the name of the filter will be passed to the called filter function as arguments after the ORM class.
find_many ( ) : array | Granada\ResultSet Tell the ORM that you are expecting multiple results from your query, and execute it. Will return an array of instances of the ORM class, or an empty array if no rows were returned.
find_one ( integer $id = null ) Wrap Idiorm's find_one method to return an instance of the class associated with this wrapper instead of the raw ORM class.
find_pairs ( $key = false, $value = false ) Added: Return pairs as result array('keyrecord_value'=>'valuerecord_value',.
for_table ( $table_name, $connection_name = parent::DEFAULT_CONNECTION ) Factory method, return an instance of this class bound to the supplied table name.
group_by_raw ( $expr ) Add an unquoted expression to the list of columns to GROUP BY
insert ( $rows, $ignore = false ) To create and save multiple elements, easy way Using an array with rows array(array('name'=>'value',.
order_by_raw ( $clause ) Add an unquoted expression as an ORDER BY clause
pluck ( string $column ) : mixed Pluck a single column from the result.
raw_join ( $join ) Create raw_join
reset_relation ( ) : Wrapper Added: Reset relation deletes the relationship "where" condition.
select_raw ( $expr, $alias = null ) Overload select_expr name
set_class_name ( string $class_name ) Set the name of the class which the wrapped methods should return instances of.
where_id_in ( $ids ) Special method to query the table by its primary key
with ( ) : Wrapper Added: Set the eagerly loaded models on the queryable model.

보호된 메소드들

메소드 설명
_create_model_instance ( $orm ) Method to create an instance of the model class associated with this wrapper and populate it with the supplied Idiorm instance.
_get_instances ( array $rows ) : array Override Idiorm _instances_with_id_as_key Create instances of each row in the result and map them to an associative array with the primary IDs as the array keys.

메소드 상세

__call() 공개 메소드

.....
public __call ( $method, $parameters )

_create_model_instance() 보호된 메소드

Method to create an instance of the model class associated with this wrapper and populate it with the supplied Idiorm instance.
protected _create_model_instance ( $orm )

_get_instances() 보호된 메소드

Added: the array result key = primary key from the model Added: Eager loading of relationships defined "with()"
protected _get_instances ( array $rows ) : array
$rows array
리턴 array

assoc_to_keyval() 공개 정적인 메소드

Converts a multi-dimensional associative array into an array of key => values with the provided field names
public static assoc_to_keyval ( $assoc = null, boolean | string $key_field = null, boolean | string $val_field = null ) : array
$key_field boolean | string
$val_field boolean | string
리턴 array

create() 공개 메소드

Wrap Idiorm's create method to return an empty instance of the class associated with this wrapper instead of the raw ORM class.
public create ( $data = null )

filter() 공개 메소드

Add a custom filter to the method chain specified on the model class. This allows custom queries to be added to models. The filter should take an instance of the ORM wrapper as its first argument and return an instance of the ORM wrapper. Any arguments passed to this method after the name of the filter will be passed to the called filter function as arguments after the ORM class.
public filter ( )

find_many() 공개 메소드

Tell the ORM that you are expecting multiple results from your query, and execute it. Will return an array of instances of the ORM class, or an empty array if no rows were returned.
public find_many ( ) : array | Granada\ResultSet
리턴 array | Granada\ResultSet

find_one() 공개 메소드

Added: hidrate the model instance before returning
public find_one ( integer $id = null )
$id integer

find_pairs() 공개 메소드

....)
public find_pairs ( $key = false, $value = false )

for_table() 공개 정적인 메소드

A repeat of content in parent::for_table, so that created class is ORMWrapper, not ORM
public static for_table ( $table_name, $connection_name = parent::DEFAULT_CONNECTION )

group_by_raw() 공개 메소드

Add an unquoted expression to the list of columns to GROUP BY
public group_by_raw ( $expr )

insert() 공개 메소드

..), array('name2'=>'value2',...),..) or a array multiple
public insert ( $rows, $ignore = false )

order_by_raw() 공개 메소드

Add an unquoted expression as an ORDER BY clause
public order_by_raw ( $clause )

pluck() 공개 메소드

Pluck a single column from the result.
public pluck ( string $column ) : mixed
$column string
리턴 mixed

raw_join() 공개 메소드

Create raw_join
public raw_join ( $join )

reset_relation() 공개 메소드

Added: Reset relation deletes the relationship "where" condition.
public reset_relation ( ) : Wrapper
리턴 Wrapper

select_raw() 공개 메소드

Overload select_expr name
public select_raw ( $expr, $alias = null )

set_class_name() 공개 메소드

Set the name of the class which the wrapped methods should return instances of.
public set_class_name ( string $class_name )
$class_name string

where_id_in() 공개 메소드

Special method to query the table by its primary key
public where_id_in ( $ids )

with() 공개 메소드

Added: Set the eagerly loaded models on the queryable model.
public with ( ) : Wrapper
리턴 Wrapper

프로퍼티 상세

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

The wrapped find_one and find_many classes will return an instance or instances of this class.
protected $_class_name

$relationships 공개적으로 프로퍼티

public $relationships