trait HasOneOrMany

Adapted from october\rain\database\relations\HasOneOrMany

Traits

Adapted from october\rain\database\relations\DeferOneOrMany

Properties

protected string $relationName

Methods

Builder
withDeferred($sessionKey)

Returns the model query with deferred bindings added

Expression
getWithDeferredQualifiedKeyName()

Returns the related "slave id" key in a database friendly format.

save(Model $model, $sessionKey = null)

Save the supplied related model with deferred binding support.

array
saveMany(array $models, $sessionKey = null)

Alias for the addMany() method.

create(array $attributes = [], $sessionKey = null)

Create a new instance of this related model with deferred binding support.

add(Model $model, $sessionKey = null)

Adds a model to this relationship type.

void
addMany(array $models, $sessionKey = null)

Attach an array of models to the parent instance with deferred binding support.

remove(Model $model, $sessionKey = null)

Removes a model from this relationship type.

string
getForeignKey()

Get the foreign key for the relationship.

string
getOtherKey()

Get the associated "other" key of the relationship.

Details

in DeferOneOrMany at line 17
Builder withDeferred($sessionKey)

Returns the model query with deferred bindings added

Parameters

$sessionKey

Return Value

Builder

in DeferOneOrMany at line 125
protected Expression getWithDeferredQualifiedKeyName()

Returns the related "slave id" key in a database friendly format.

Return Value

Expression

at line 22
save(Model $model, $sessionKey = null)

Save the supplied related model with deferred binding support.

Parameters

Model $model
$sessionKey

at line 38
array saveMany(array $models, $sessionKey = null)

Alias for the addMany() method.

Parameters

array $models
$sessionKey

Return Value

array

at line 48
create(array $attributes = [], $sessionKey = null)

Create a new instance of this related model with deferred binding support.

Parameters

array $attributes
$sessionKey

at line 62
add(Model $model, $sessionKey = null)

Adds a model to this relationship type.

Parameters

Model $model
$sessionKey

at line 91
void addMany(array $models, $sessionKey = null)

Attach an array of models to the parent instance with deferred binding support.

Parameters

array $models
$sessionKey

Return Value

void

at line 101
remove(Model $model, $sessionKey = null)

Removes a model from this relationship type.

Parameters

Model $model
$sessionKey

at line 126
string getForeignKey()

Get the foreign key for the relationship.

Return Value

string

at line 135
string getOtherKey()

Get the associated "other" key of the relationship.

Return Value

string