trait PreventsCircularRecursion

Constants

protected RECURSION_CACHE_CONTEXT_KEY

The context key for the recursion cache.

Methods

mixed
withoutRecursion(callable $callback, mixed $default = null)

Prevent a method from being called multiple times on the same object within the same call stack.

static void
clearRecursiveCallValue(object $object, string $hash)

Remove an entry from the recursion cache for an object.

static array
getRecursiveCallStack(object $object)

Get the stack of methods being called recursively for the current object.

static WeakMap
getRecursionCache()

Get the current recursion cache being used by the model.

static mixed
setRecursiveCallValue(object $object, string $hash, mixed $value)

Set a value in the recursion cache for the given object and method.

Details

at line 22
protected mixed withoutRecursion(callable $callback, mixed $default = null)

Prevent a method from being called multiple times on the same object within the same call stack.

Parameters

callable $callback
mixed $default

Return Value

mixed

at line 52
static protected void clearRecursiveCallValue(object $object, string $hash)

Remove an entry from the recursion cache for an object.

Parameters

object $object
string $hash

Return Value

void

at line 66
static protected array getRecursiveCallStack(object $object)

Get the stack of methods being called recursively for the current object.

Parameters

object $object

Return Value

array

at line 78
static protected WeakMap getRecursionCache()

Get the current recursion cache being used by the model.

Return Value

WeakMap

at line 86
static protected mixed setRecursiveCallValue(object $object, string $hash, mixed $value)

Set a value in the recursion cache for the given object and method.

Parameters

object $object
string $hash
mixed $value

Return Value

mixed