DeferredBinding

 trait Winter\Storm\Database\Traits\DeferredBinding

Properties

public $sessionKey : string

A unique session key used for deferred binding.

Methods

public bindDeferred (string $relation, Illuminate\Database\Eloquent\Model $record, string $sessionKey, array $pivotData = []) : Winter\Storm\Database\Models\DeferredBinding

Bind a deferred relationship to the supplied record.

Parameters
Property Description
$relation
string
$record
Illuminate\Database\Eloquent\Model
$sessionKey
string
$pivotData
array
Returns
Winter\Storm\Database\Models\DeferredBinding

public cancelDeferred (string $sessionKey) : void

Cancel all deferred bindings to this model.

Parameters
Property Description
$sessionKey
string
Returns
void

public commitDeferred (string $sessionKey) : void

Commit all deferred bindings to this model.

Parameters
Property Description
$sessionKey
string
Returns
void

public isDeferrable (string $relationName) : bool

Returns true if a relation exists and can be deferred.

Parameters
Property Description
$relationName
string
Returns
bool

public unbindDeferred (string $relation, Illuminate\Database\Eloquent\Model $record, string $sessionKey) : Winter\Storm\Database\Models\DeferredBinding

Unbind a deferred relationship to the supplied record.

Parameters
Property Description
$relation
string
$record
Illuminate\Database\Eloquent\Model
$sessionKey
string
Returns
Winter\Storm\Database\Models\DeferredBinding

protected commitDeferredAfter (string $sessionKey) : void

Internally used method to commit all deferred bindings after saving.

Parameters
Property Description
$sessionKey
string
Returns
void

protected commitDeferredBefore (string $sessionKey) : void

Internally used method to commit all deferred bindings before saving.

It is a rare need to have to call this, since it only applies to the "belongs to" relationship which generally does not need deferring.

Parameters
Property Description
$sessionKey
string
Returns
void

protected commitDeferredOfType (string $sessionKey, $include = null, $exclude = null) : void

Internal method for committing deferred relations.

Parameters
Property Description
$sessionKey
string
$include
mixed
$exclude
mixed
Returns
void

protected getDeferrableRelationTypes () : array

Returns all possible relation types that can be deferred.

Returns
array

protected getDeferredBindingRecords (string $sessionKey) : Winter\Storm\Database\Collection

Returns any outstanding binding records for this model.

Parameters
Property Description
$sessionKey
string
Returns
Winter\Storm\Database\Collection
Copyright © 2024 Winter CMS