HasMany
extends AbstractRelationship
in package
Relationship class for "has many" relationships
Tags
Table of Contents
Properties
- $children : string|null
- Relationship children
- $foreignKey : string|null
- Foreign key
- $foreignTable : string|null
- Foreign table class
- $options : array<string|int, mixed>|null
- Relationship options
- $parent : Record|null
- Parent record
Methods
- __construct() : mixed
- Constructor
- getChildRelationships() : string|null
- Get child relationships
- getChildren() : Collection
- Get children
- getEagerRelationships() : array<string|int, mixed>
- Get eager relationships
- getForeignKey() : string|null
- Get foreign key
- getForeignTable() : string|null
- Get foreign table class
- getOptions() : array<string|int, mixed>|null
- Get options
- getParent() : Record|null
- Get parent record
- setChildRelationships() : static
- Set children child relationships
Properties
$children
Relationship children
protected
string|null
$children
= null
$foreignKey
Foreign key
protected
string|null
$foreignKey
= null
$foreignTable
Foreign table class
protected
string|null
$foreignTable
= null
$options
Relationship options
protected
array<string|int, mixed>|null
$options
= null
$parent
Parent record
protected
Record|null
$parent
= null
Methods
__construct()
Constructor
public
__construct(Record $parent, string $foreignTable, string $foreignKey[, array<string|int, mixed>|null $options = null ]) : mixed
Instantiate the relationship object
Parameters
- $parent : Record
- $foreignTable : string
- $foreignKey : string
- $options : array<string|int, mixed>|null = null
getChildRelationships()
Get child relationships
public
getChildRelationships() : string|null
Return values
string|nullgetChildren()
Get children
public
getChildren([array<string|int, mixed>|null $options = null ]) : Collection
Parameters
- $options : array<string|int, mixed>|null = null
Return values
CollectiongetEagerRelationships()
Get eager relationships
public
getEagerRelationships(array<string|int, mixed> $ids[, bool $toArray = false ]) : array<string|int, mixed>
Parameters
- $ids : array<string|int, mixed>
- $toArray : bool = false
Tags
Return values
array<string|int, mixed>getForeignKey()
Get foreign key
public
getForeignKey() : string|null
Return values
string|nullgetForeignTable()
Get foreign table class
public
getForeignTable() : string|null
Return values
string|nullgetOptions()
Get options
public
getOptions() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetParent()
Get parent record
public
getParent() : Record|null
Return values
Record|nullsetChildRelationships()
Set children child relationships
public
setChildRelationships(string $children) : static
Parameters
- $children : string