Relation extends Type implements TypeInterface
The Relation complex data type.
Tags
Interfaces, Classes and Traits
- TypeInterface
- The interface for all complex data types.
Table of Contents
- MAX_SIZE = 11
- The absolute maximum size of the value for the this Relation.
- $helper : string
- The error message for the Relation type when validation fails.
- $allowableRelationTypes : array<string|int, mixed>
- An array of the allowable relationship types ('MANY-TO-ONE' or 'ONE-TO-MANY' or 'ONE-TO-ONE' or 'MANY-TO-MANY').
- $IDs : array<string|int, mixed>
- In the case of MANY-TO-MANY relationship, this transient array can be used to hold the IDs of related records.
- $lookup : RelationLookup
- In the case of MANY-TO-MANY relationship, a lookup object will be required.
- $relatedClass : string
- The name of the business object class which this class is related to.
- $relatedClassDisplayField : string
- The name of the field from the related business object class which is displayed by the selection widget.
- $relatedClassField : string
- The name of the fields of the business object class by which this class is related by.
- $relatedClassHeaderFields : array<string|int, mixed>
- An array of fields to use the values of while rendering related display values via the selection widget.
- $relatedClassLeft : string
- The name of the business object class on the left of a MANY-TO-MANY relation.
- $relatedClassLeftDisplayField : string
- The name of the field from the related business object class on the left of a MANY-TO-MANY relation which is displayed by the selection widget.
- $relatedClassRight : string
- The name of the business object class on the right of a MANY-TO-MANY relation.
- $relatedClassRightDisplayField : string
- The name of the field from the related business object class on the right of a MANY-TO-MANY relation which is displayed by the selection widget.
- $relationType : string
- The type of relation ('MANY-TO-ONE' or 'ONE-TO-MANY' or 'ONE-TO-ONE' or 'MANY-TO-MANY').
- $size : int
- The size of the value for the this Relation.
- $taggedClass : string
- When building a relation with the TagObject record, set this to the name of the tagged class.
- $validationRule : string
- The validation rule for the Relation type.
- $value : mixed
- The ID value of the related object. In the special case of a MANY-TO-MANY relation, contains the ID of the object on the current, accessing side. Can contain NULL.
- __construct() : mixed
- Constructor.
- __toString() : string
- Used to convert the object to a printable string.
- getHelper() : string
- Used to get the validation helper message string.
- getLookup() : RelationLookup
- Get the lookup object if available (only on MANY-TO-MANY relations, null otherwise).
- getRelated() : array<string|int, mixed>|ActiveRecord
- For one-to-many and many-to-many relations, get an array of records on the other side. For one-to-one relations, get the record (Alpha\Model\ActiveRecord instance) on the other side.
- getRelatedClass() : string
- Get the name of the business object class that this class is related to.
- getRelatedClassDisplayField() : string
- Getter for the display field from the related class.
- getRelatedClassDisplayFieldValue() : string
- Getter for the display value of the related class field. In the case of a MANY-TO-MANY Relation, a comma-seperated sorted list of values is returned.
- getRelatedClassField() : string
- Getter for the field of the related class.
- getRelatedClassHeaderFields() : array<string|int, mixed>
- Getter for the selection widget field headings of the related class.
- getRelatedIDs() : array<string|int, mixed>
- Getter for the array of IDs used by MANY-TO-MANY instances.
- getRelationType() : string
- Getter for the relation type.
- getRule() : string
- Get the validation rule.
- getSide() : string
- Gets the side ('left' or 'right') of the passed classname on the current Relation object.
- getSize() : int
- Get the allowable size of the Relation in the database field.
- getValue() : string
- Getter for the Relation value.
- setHelper() : mixed
- Set the validation helper text.
- setRelatedClass() : mixed
- Set the name of the business object class that this class is related to.
- setRelatedClassDisplayField() : mixed
- Setter for the display field from the related class.
- setRelatedClassField() : mixed
- Setter for the field of the related class.
- setRelatedClassHeaderFields() : mixed
- Setter for ONE-TO-MANY relations, which sets the header fields to render from the related class.
- setRelatedIDs() : mixed
- Setter for the array of IDs used by MANY-TO-MANY instances.
- setRelationType() : mixed
- Setter for the relation type.
- setRule() : mixed
- Setter to override the default validation rule.
- setTaggedClass() : mixed
- Set the taggedClass property to the name of the tagged class when building relations to the TagObject record.
- setValue() : mixed
- Setter for the value ID of this relation.
Constants
MAX_SIZE
The absolute maximum size of the value for the this Relation.
    public
    int
    MAX_SIZE
    = 11
        
    
    Tags
Properties
$helper
The error message for the Relation type when validation fails.
    protected
        string
    $helper
    
        
    
    Tags
$allowableRelationTypes
An array of the allowable relationship types ('MANY-TO-ONE' or 'ONE-TO-MANY' or 'ONE-TO-ONE' or 'MANY-TO-MANY').
    private
        array<string|int, mixed>
    $allowableRelationTypes
     = array('MANY-TO-ONE', 'ONE-TO-MANY', 'ONE-TO-ONE', 'MANY-TO-MANY')
        
    
    Tags
$IDs
In the case of MANY-TO-MANY relationship, this transient array can be used to hold the IDs of related records.
    private
        array<string|int, mixed>
    $IDs
     = array()
        
    
    Tags
$lookup
In the case of MANY-TO-MANY relationship, a lookup object will be required.
    private
        RelationLookup
    $lookup
    
        
    
    Tags
$relatedClass
The name of the business object class which this class is related to.
    private
        string
    $relatedClass
    
        
    
    Tags
$relatedClassDisplayField
The name of the field from the related business object class which is displayed by the selection widget.
    private
        string
    $relatedClassDisplayField
    
        
    
    Tags
$relatedClassField
The name of the fields of the business object class by which this class is related by.
    private
        string
    $relatedClassField
    
        
    
    Tags
$relatedClassHeaderFields
An array of fields to use the values of while rendering related display values via the selection widget.
    private
        array<string|int, mixed>
    $relatedClassHeaderFields
     = array()
        
    
    Tags
$relatedClassLeft
The name of the business object class on the left of a MANY-TO-MANY relation.
    private
        string
    $relatedClassLeft
    
        
    
    Tags
$relatedClassLeftDisplayField
The name of the field from the related business object class on the left of a MANY-TO-MANY relation which is displayed by the selection widget.
    private
        string
    $relatedClassLeftDisplayField
    
        
    
    Tags
$relatedClassRight
The name of the business object class on the right of a MANY-TO-MANY relation.
    private
        string
    $relatedClassRight
    
        
    
    Tags
$relatedClassRightDisplayField
The name of the field from the related business object class on the right of a MANY-TO-MANY relation which is displayed by the selection widget.
    private
        string
    $relatedClassRightDisplayField
    
        
    
    Tags
$relationType
The type of relation ('MANY-TO-ONE' or 'ONE-TO-MANY' or 'ONE-TO-ONE' or 'MANY-TO-MANY').
    private
        string
    $relationType
    
        
    
    Tags
$size
The size of the value for the this Relation.
    private
        int
    $size
     = 11
        
    
    Tags
$taggedClass
When building a relation with the TagObject record, set this to the name of the tagged class.
    private
        string
    $taggedClass
    
        
    
    Tags
$validationRule
The validation rule for the Relation type.
    private
        string
    $validationRule
    
        
    
    Tags
$value
The ID value of the related object. In the special case of a MANY-TO-MANY relation, contains the ID of the object on the current, accessing side. Can contain NULL.
    private
        mixed
    $value
     = null
        
    
    Tags
Methods
__construct()
Constructor.
    public
                __construct() : mixed
        
    
    
    Tags
Return values
mixed —__toString()
Used to convert the object to a printable string.
    public
                __toString() : string
        
    
    
    Tags
Return values
string —getHelper()
Used to get the validation helper message string.
    public
                getHelper() : string
        
    
    
    Tags
Return values
string —getLookup()
Get the lookup object if available (only on MANY-TO-MANY relations, null otherwise).
    public
                getLookup() : RelationLookup
        
    
    
    Tags
Return values
RelationLookup —getRelated()
For one-to-many and many-to-many relations, get an array of records on the other side. For one-to-one relations, get the record (Alpha\Model\ActiveRecord instance) on the other side.
    public
                getRelated([mixed $accessingClassName = '' ]) : array<string|int, mixed>|ActiveRecord
        string $accessingClassName Used to indicate the reading side when accessing from MANY-TO-MANY relation (leave blank for other relation types)
Parameters
- $accessingClassName : mixed = ''
Tags
Return values
array<string|int, mixed>|ActiveRecord —getRelatedClass()
Get the name of the business object class that this class is related to.
    public
                getRelatedClass([string $side = '' ]) : string
        
        Parameters
- $side : string = ''
Tags
Return values
string —getRelatedClassDisplayField()
Getter for the display field from the related class.
    public
                getRelatedClassDisplayField([string $side = '' ]) : string
        
        Parameters
- $side : string = ''
- 
                    Only required for MANY-TO-MANY relations 
Tags
Return values
string —getRelatedClassDisplayFieldValue()
Getter for the display value of the related class field. In the case of a MANY-TO-MANY Relation, a comma-seperated sorted list of values is returned.
    public
                getRelatedClassDisplayFieldValue([string $accessingClassName = '' ]) : string
        
        Parameters
- $accessingClassName : string = ''
- 
                    Used to indicate the reading side when accessing from MANY-TO-MANY relation (leave blank for other relation types) 
Tags
Return values
string —getRelatedClassField()
Getter for the field of the related class.
    public
                getRelatedClassField() : string
        
    
    
    Tags
Return values
string —getRelatedClassHeaderFields()
Getter for the selection widget field headings of the related class.
    public
                getRelatedClassHeaderFields() : array<string|int, mixed>
        
    
    
    Tags
Return values
array<string|int, mixed> —getRelatedIDs()
Getter for the array of IDs used by MANY-TO-MANY instances.
    public
                getRelatedIDs() : array<string|int, mixed>
        
    
    
    Tags
Return values
array<string|int, mixed> —getRelationType()
Getter for the relation type.
    public
                getRelationType() : string
        
    
    
    Tags
Return values
string —getRule()
Get the validation rule.
    public
                getRule() : string
        
    
    
    Tags
Return values
string —getSide()
Gets the side ('left' or 'right') of the passed classname on the current Relation object.
    public
                getSide(string $RecordClassname) : string
        
        Parameters
- $RecordClassname : string
Tags
Return values
string —getSize()
Get the allowable size of the Relation in the database field.
    public
                getSize() : int
        
    
    
    Tags
Return values
int —getValue()
Getter for the Relation value.
    public
                getValue() : string
        
    
    
    Tags
Return values
string —setHelper()
Set the validation helper text.
    public
                setHelper(string $helper) : mixed
        
        Parameters
- $helper : string
Tags
Return values
mixed —setRelatedClass()
Set the name of the business object class that this class is related to.
    public
                setRelatedClass(string $RC[, string $side = '' ]) : mixed
        
        Parameters
- $RC : string
- $side : string = ''
- 
                    Only required for MANY-TO-MANY relations 
Tags
Return values
mixed —setRelatedClassDisplayField()
Setter for the display field from the related class.
    public
                setRelatedClassDisplayField(string $RCDF[, string $side = '' ]) : mixed
        
        Parameters
- $RCDF : string
- $side : string = ''
- 
                    Only required for MANY-TO-MANY relations 
Tags
Return values
mixed —setRelatedClassField()
Setter for the field of the related class.
    public
                setRelatedClassField(string $RCF) : mixed
        
        Parameters
- $RCF : string
Tags
Return values
mixed —setRelatedClassHeaderFields()
Setter for ONE-TO-MANY relations, which sets the header fields to render from the related class.
    public
                setRelatedClassHeaderFields(array<string|int, mixed> $fieldNames) : mixed
        
        Parameters
- $fieldNames : array<string|int, mixed>
Tags
Return values
mixed —setRelatedIDs()
Setter for the array of IDs used by MANY-TO-MANY instances.
    public
                setRelatedIDs(array<string|int, mixed> $IDs) : mixed
        
        Parameters
- $IDs : array<string|int, mixed>
Tags
Return values
mixed —setRelationType()
Setter for the relation type.
    public
                setRelationType(string $RT) : mixed
        
        Parameters
- $RT : string
Tags
Return values
mixed —setRule()
Setter to override the default validation rule.
    public
                setRule(string $rule) : mixed
        
        Parameters
- $rule : string
Tags
Return values
mixed —setTaggedClass()
Set the taggedClass property to the name of the tagged class when building relations to the TagObject record.
    public
                setTaggedClass(string $taggedClass) : mixed
        
        Parameters
- $taggedClass : string
Tags
Return values
mixed —setValue()
Setter for the value ID of this relation.
    public
                setValue(int $val) : mixed
        
        Parameters
- $val : int