Property | Type | Description | |
---|---|---|---|
$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. |
Property | Type | Description | |
---|---|---|---|
$__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. |
Method | Description | |
---|---|---|
__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 = [] ) : |
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 = [] ) : |
Returns referenced model without any extra conditions. However other relationship types may override this to imply conditions. | |
refModel ( array $defaults = [] ) : |
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 __construct ( array $defaults = [] ) | ||
$defaults | array |
public __debugInfo ( ) : array | ||
return | array |
public guessFieldType ( string $their_field = null ) : string | ||
$their_field | string | |
return | string |
protected $__debug_fields |
protected string $link | ||
return | string |
public Model,atk4\data|null $model | ||
return |
protected string $our_field | ||
return | string |
protected string $table_alias | ||
return | string |
protected string $their_field | ||
return | string |