PHP 클래스 atk4\data\Reference

It's possible to extend the basic reference with more meaningful references.
상속: use trait atk4\core\InitializerTrait, use trait atk4\core\TrackableTrait
파일 보기 프로젝트 열기: atk4/data

공개 프로퍼티들

프로퍼티 타입 설명
$model Model | null Definition of the destination model, that can be either an object, a callback or a string. This can be defined during initialization and then used inside getModel() to fully populate and associate with persistence.

보호된 프로퍼티들

프로퍼티 타입 설명
$__debug_fields List of properties to show in var_dump.
$link string Each reference has a unique identifier, although it's stored in Model's elements as '#ref-xx'.
$our_field string This is an optional property which can be used by your implementation to store field-level relationship based on a common field matching.
$table_alias string Use this alias for related entity by default. This can help you if you create sub-queries or joins to separate this from main table. The table_alias will be uniquelly generated.
$their_field string This is an optional property which can be used by your implementation to store field-level relationship based on a common field matching.

공개 메소드들

메소드 설명
__construct ( array $defaults = [] ) Default constructor. Will copy argument into properties.
__debugInfo ( ) : array Returns array with useful debug info for var_dump.
_init ( )
getDesiredName ( ) : string Will use #ref_.
getModel ( array $defaults = [] ) : Model Returns destination model that is linked through this reference. Will apply necessary conditions.
guessFieldType ( string $their_field = null ) : string If you have set $their_field property correctly, then calling this method will traverse into a related model and fetch the type of their field. This method will be extra careful to avoid any loops.
init ( ) Initialization.
ref ( array $defaults = [] ) : Model Returns referenced model without any extra conditions. However other relationship types may override this to imply conditions.
refModel ( array $defaults = [] ) : Model Returns referenced model without any extra conditions. Ever when extended must always respond with Model that does not look into current record or scope.

메소드 상세

__construct() 공개 메소드

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

__debugInfo() 공개 메소드

Returns array with useful debug info for var_dump.
public __debugInfo ( ) : array
리턴 array

_init() 공개 메소드

public _init ( )

getDesiredName() 공개 메소드

Will use #ref_.
public getDesiredName ( ) : string
리턴 string

getModel() 공개 메소드

Returns destination model that is linked through this reference. Will apply necessary conditions.
public getModel ( array $defaults = [] ) : Model
$defaults array Properties
리턴 Model

guessFieldType() 공개 메소드

If you have set $their_field property correctly, then calling this method will traverse into a related model and fetch the type of their field. This method will be extra careful to avoid any loops.
public guessFieldType ( string $their_field = null ) : string
$their_field string
리턴 string

init() 공개 메소드

Initialization.
public init ( )

ref() 공개 메소드

Returns referenced model without any extra conditions. However other relationship types may override this to imply conditions.
public ref ( array $defaults = [] ) : Model
$defaults array Properties
리턴 Model

refModel() 공개 메소드

Returns referenced model without any extra conditions. Ever when extended must always respond with Model that does not look into current record or scope.
public refModel ( array $defaults = [] ) : Model
$defaults array Properties
리턴 Model

프로퍼티 상세

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

List of properties to show in var_dump.
protected $__debug_fields

$model 공개적으로 프로퍼티

Definition of the destination model, that can be either an object, a callback or a string. This can be defined during initialization and then used inside getModel() to fully populate and associate with persistence.
public Model,atk4\data|null $model
리턴 Model | null

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

This is an optional property which can be used by your implementation to store field-level relationship based on a common field matching.
protected string $our_field
리턴 string

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

Use this alias for related entity by default. This can help you if you create sub-queries or joins to separate this from main table. The table_alias will be uniquelly generated.
protected string $table_alias
리턴 string

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

This is an optional property which can be used by your implementation to store field-level relationship based on a common field matching.
protected string $their_field
리턴 string