Neuron-PHP

HasMany
in package

Defines a has-many relationship (one-to-many).

Example: A User has many Posts

Attributes
#[Attribute]
\Attribute::TARGET_PROPERTY

Table of Contents

Properties

$dependent  : DependentStrategy|null
$foreignKey  : string|null
$localKey  : string|null
$relatedModel  : string

Methods

__construct()  : mixed
Constructor

Properties

$foreignKey read-only

public string|null $foreignKey = null

$localKey read-only

public string|null $localKey = 'id'

$relatedModel read-only

public string $relatedModel

Methods

__construct()

Constructor

public __construct(string $relatedModel[, string|null $foreignKey = null ][, string|null $localKey = 'id' ][, DependentStrategy|null $dependent = null ]) : mixed
Parameters
$relatedModel : string

The fully qualified class name of the related model

$foreignKey : string|null = null

The foreign key column name on related table

$localKey : string|null = 'id'

The local key column name (default: id)

$dependent : DependentStrategy|null = null

Cascade behavior when parent is destroyed


        
On this page

Search results