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 | Type | Description |
---|---|---|
$relation | string |
string
|
$record | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | string |
string
|
$pivotData | array |
array
|
Returns
Winter\Storm\Database\Models\DeferredBinding
public cancelDeferred (string $sessionKey) : void
Cancel all deferred bindings to this model.
Parameters
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
Returns
void
public commitDeferred (string $sessionKey) : void
Commit all deferred bindings to this model.
Parameters
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
Returns
void
public isDeferrable (string $relationName) : bool
Returns true if a relation exists and can be deferred.
Parameters
Property | Type | Description |
---|---|---|
$relationName | string |
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 | Type | Description |
---|---|---|
$relation | string |
string
|
$record | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | string |
string
|
Returns
Winter\Storm\Database\Models\DeferredBinding
protected commitDeferredAfter (string $sessionKey) : void
Internally used method to commit all deferred bindings after saving.
Parameters
Property | Type | Description |
---|---|---|
$sessionKey | string |
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 | Type | Description |
---|---|---|
$sessionKey | string |
string
|
Returns
void
protected
commitDeferredOfType (string $sessionKey, $include = null
, $exclude = null
)
: void
Internal method for committing deferred relations.
Parameters
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
$include | mixed |
mixed
|
$exclude | mixed |
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 | Type | Description |
---|---|---|
$sessionKey | string |
string
|
Returns
Winter\Storm\Database\Collection
Copyright © 2023 Winter CMS