BelongsTo
extends AbstractRelationship
in package
Relationship class for "belongs to" relationships
Tags
Table of Contents
- $child : Record
- Child record
- $children : string
- Relationship children
- $foreignKey : string
- Foreign key
- $foreignTable : string
- Foreign table class
- $options : array<string|int, mixed>
- Relationship options
- __construct() : mixed
- Constructor
- getChild() : Record
- Get child record
- getChildRelationships() : string
- Get child relationships
- getEagerRelationships() : array<string|int, mixed>
- Get eager relationships
- getForeignKey() : string
- Get foreign key
- getForeignTable() : string
- Get foreign table class
- getOptions() : array<string|int, mixed>
- Get options
- getParent() : Record
- Get parent
- setChildRelationships() : static
- Set children child relationships
Properties
$child
Child record
protected
Record
$child
$children
Relationship children
protected
string
$children
= null
$foreignKey
Foreign key
protected
string
$foreignKey
= null
$foreignTable
Foreign table class
protected
string
$foreignTable
= null
$options
Relationship options
protected
array<string|int, mixed>
$options
= null
Methods
__construct()
Constructor
public
__construct(Record $child, string $foreignTable, string $foreignKey[, array<string|int, mixed> $options = null ]) : mixed
Instantiate the relationship object
Parameters
- $child : Record
- $foreignTable : string
- $foreignKey : string
- $options : array<string|int, mixed> = null
Return values
mixed —getChild()
Get child record
public
getChild() : Record
Return values
Record —getChildRelationships()
Get child relationships
public
getChildRelationships() : string
Return values
string —getEagerRelationships()
Get eager relationships
public
getEagerRelationships(array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
- $ids : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getForeignKey()
Get foreign key
public
getForeignKey() : string
Return values
string —getForeignTable()
Get foreign table class
public
getForeignTable() : string
Return values
string —getOptions()
Get options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getParent()
Get parent
public
getParent([array<string|int, mixed> $options = null ]) : Record
Parameters
- $options : array<string|int, mixed> = null
Return values
Record —setChildRelationships()
Set children child relationships
public
setChildRelationships(string $children) : static
Parameters
- $children : string