October\Rain\Database\Traits\DeferredBinding

Overview

DeferredBinding trait is implemented by all models


Public Properties

public string $sessionKey

sessionKey is a unique session key used for deferred binding


Public Methods

public bindDeferred()

public bindDeferred(
    $relation,
    $record,
    $sessionKey,
    $pivotData = []
): October\Rain\Database\Models\DeferredBinding 

bindDeferred binds a deferred relationship to the supplied record

public cancelDeferred()

public cancelDeferred($sessionKey): void 

cancelDeferred cancels all deferred bindings to this model

public commitDeferred()

public commitDeferred($sessionKey): void

commitDeferred commits all deferred bindings to this model

public hasDeferred()

public hasDeferred($sessionKey = null, $relationName = null): bool 

hasDeferred returns true if a deferred record exists for a relation

public isDeferrable()

public isDeferrable($relationName): bool 

isDeferrable returns true if a relation exists and can be deferred

public unbindDeferred()

public unbindDeferred(
    $relation,
    $record,
    $sessionKey
): October\Rain\Database\Models\DeferredBinding 

unbindDeferred unbinds a deferred relationship to the supplied record

Protected Methods

protected commitDeferredAfter()

protected commitDeferredAfter($sessionKey): void

commitDeferredAfter is used internally to commit all deferred bindings after saving

protected commitDeferredBefore()

protected commitDeferredBefore($sessionKey): void

commitDeferredBefore is used internally 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.

protected commitDeferredOfType()

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

commitDeferredOfType is an internal method for committing deferred relations

protected getDeferrableRelationTypes()

protected getDeferrableRelationTypes(): array 

getDeferrableRelationTypes returns all possible relation types that can be deferred

protected getDeferredBindingRecords()

protected getDeferredBindingRecords(
    $sessionKey
): October\Rain\Database\Collection 

getDeferredBindingRecords returns any outstanding binding records for this model