PHP 클래스 atk4\data\Join

상속: use trait atk4\core\TrackableTrait, use trait atk4\core\InitializerTrait
파일 보기 프로젝트 열기: atk4/data

보호된 프로퍼티들

프로퍼티 타입 설명
$foreign_field Field to be used for matching in a foreign table. By default it's 'id'.
$foreign_table For SQL, This can also be an expression or sub-select.
$id ID used by a joined table.
$id_field When deleting record, this field will be conditioned. ->where($join->id_field, $join->id)->delete();
$join When join is done on another join.
$master_field Field to be used for matching inside master field. By default it's $foreign_table.'_id'.
$persistence If $persistence is set, then it's used for loading and storing the values, instead $owner->persistence.
$prefix When $prefix is set, then all the fields generated through our wrappers will be automatically prefixed inside the model.
$reverse If you are using the following syntax: $user->join('contact','default_contact_id'); Then the ID connecting tables is stored in foreign table and the order of saving and delete needs to be reversed. In this case $reverse will be set to true. You can specify value of this property.
$save_buffer Data which is populated here as the save/insert progresses.
$weak Is our join weak? Weak join will stop you from touching foreign table.

공개 메소드들

메소드 설명
__construct ( $defaults = [] ) default constructor. Will copy argument into properties.
_init ( )
add ( $object, $defaults = [] )
addField ( $n, $defaults = [] ) Adding field into join will automatically associate that field with this join. That means it won't be loaded from $table, but form the join instead.
addFields ( $fields = [] )
afterUnload ( )
containsMany ( $model, $defaults = [] ) wrapper for containsMany that will associate field with join.
containsOne ( $model, $defaults = [] ) wrapper for containsOne that will associate field with join.
getDesiredName ( ) Will use either foreign_alias or create #join_.
hasMany ( $model, $defaults = [] ) creates reference based on the field from the join.
hasOne ( $model, $defaults = [] ) creates reference based on a field from the join.
importModel ( $m, $defaults = [] ) Will iterate through this model by pulling - fields - references - conditions.
init ( )
join ( $foreign_table, $defaults = [] ) Join will be attached to a current join.
leftJoin ( $foreign_table, $defaults = [] )
set ( $field, $value )
weakJoin ( $defaults = [] ) weakJoin will be attached to a current join.
weakJoinModel ( $model, $fields = [] ) Joins with the primary table of the model and then import all of the data into our model.

메소드 상세

__construct() 공개 메소드

default constructor. Will copy argument into properties.
public __construct ( $defaults = [] )

_init() 공개 메소드

public _init ( )

add() 공개 메소드

public add ( $object, $defaults = [] )

addField() 공개 메소드

Adding field into join will automatically associate that field with this join. That means it won't be loaded from $table, but form the join instead.
public addField ( $n, $defaults = [] )

addFields() 공개 메소드

public addFields ( $fields = [] )

afterUnload() 공개 메소드

public afterUnload ( )

containsMany() 공개 메소드

wrapper for containsMany that will associate field with join.
public containsMany ( $model, $defaults = [] )

containsOne() 공개 메소드

wrapper for containsOne that will associate field with join.
public containsOne ( $model, $defaults = [] )

getDesiredName() 공개 메소드

Will use either foreign_alias or create #join_.
public getDesiredName ( )

hasMany() 공개 메소드

creates reference based on the field from the join.
public hasMany ( $model, $defaults = [] )

hasOne() 공개 메소드

creates reference based on a field from the join.
public hasOne ( $model, $defaults = [] )

importModel() 공개 메소드

and then will apply them locally. Any you think that any fields could clash, then use ['prefix'=>'m2'] which will be pre-pended to all the fields. Conditions will me automatically mapped.
public importModel ( $m, $defaults = [] )

init() 공개 메소드

public init ( )

join() 공개 메소드

Join will be attached to a current join.
public join ( $foreign_table, $defaults = [] )

leftJoin() 공개 메소드

public leftJoin ( $foreign_table, $defaults = [] )

set() 공개 메소드

public set ( $field, $value )

weakJoin() 공개 메소드

weakJoin will be attached to a current join.
public weakJoin ( $defaults = [] )

weakJoinModel() 공개 메소드

Joins with the primary table of the model and then import all of the data into our model.
public weakJoinModel ( $model, $fields = [] )

프로퍼티 상세

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

Field to be used for matching in a foreign table. By default it's 'id'.
protected $foreign_field

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

For SQL, This can also be an expression or sub-select.
protected $foreign_table

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

ID used by a joined table.
protected $id

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

When deleting record, this field will be conditioned. ->where($join->id_field, $join->id)->delete();
protected $id_field

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

When join is done on another join.
protected $join

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

Field to be used for matching inside master field. By default it's $foreign_table.'_id'.
protected $master_field

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

If $persistence is set, then it's used for loading and storing the values, instead $owner->persistence.
protected $persistence

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

When $prefix is set, then all the fields generated through our wrappers will be automatically prefixed inside the model.
protected $prefix

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

If you are using the following syntax: $user->join('contact','default_contact_id'); Then the ID connecting tables is stored in foreign table and the order of saving and delete needs to be reversed. In this case $reverse will be set to true. You can specify value of this property.
protected $reverse

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

Data which is populated here as the save/insert progresses.
protected $save_buffer

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

Is our join weak? Weak join will stop you from touching foreign table.
protected $weak