October\Rain\Database\Traits\DeferredBinding

Source: ~/vendor/october/rain/src/Database/Traits/DeferredBinding.php

Public properties

public string $sessionKey

A unique session key used for deferred binding.

Protected properties

protected October\Rain\Database\Collection $deferredBindingCache

Deferred binding lookup cache.

Public methods

public void bindDeferred($relation, $record, $sessionKey)

Bind a deferred relationship to the supplied record.

Parameters
  • $relation
  • $record
  • $sessionKey

public void cancelDeferred($sessionKey)

Cancel all deferred bindings to this model.

Parameters
  • $sessionKey

public void commitDeferred($sessionKey)

Commit all deferred bindings to this model.

Parameters
  • $sessionKey

public void isDeferrable($relationName)

Returns true if a relation exists and can be deferred.

Parameters
  • $relationName

public void unbindDeferred($relation, $record, $sessionKey)

Unbind a deferred relationship to the supplied record.

Parameters
  • $relation
  • $record
  • $sessionKey

Protected methods

protected void commitDeferredAfter($sessionKey)

Internally used method to commit all deferred bindings after saving.

Parameters
  • $sessionKey

protected void commitDeferredBefore($sessionKey)

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
  • $sessionKey

protected void commitDeferredOfType($sessionKey, $include=NULL, $exclude=NULL)

Internal method for committing deferred relations.

Parameters
  • $sessionKey
  • $include
  • $exclude

protected array getDeferrableRelationTypes()

Returns all possible relation types that can be deferred.

protected October\Rain\Database\Collection getDeferredBindingRecords($sessionKey, $force=false)

Returns any outstanding binding records for this model.

Parameters
  • $sessionKey
  • $force