HasOne
extends AbstractRelationship
in package
Relationship class for "has one" relationships
Tags
Table of Contents
- $children : string
- Relationship children
- $foreignKey : string
- Foreign key
- $foreignTable : string
- Foreign table class
- $options : array<string|int, mixed>
- Relationship options
- $parent : Record
- Parent record
- __construct() : mixed
- Constructor
- getChild() : Record
- Get child
- 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 record
- setChildRelationships() : static
- Set children child relationships
Properties
$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
$parent
Parent record
protected
Record
$parent
= null
Methods
__construct()
Constructor
public
__construct(Record $parent, string $foreignTable, string $foreignKey[, array<string|int, mixed> $options = null ]) : mixed
Instantiate the relationship object
Parameters
- $parent : Record
- $foreignTable : string
- $foreignKey : string
- $options : array<string|int, mixed> = null
Return values
mixed —getChild()
Get child
public
getChild([array<string|int, mixed> $options = null ]) : Record
Parameters
- $options : array<string|int, mixed> = null
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 record
public
getParent() : Record
Return values
Record —setChildRelationships()
Set children child relationships
public
setChildRelationships(string $children) : static
Parameters
- $children : string