com\setasign\Konquadrat\Object

InstancePool Class InstancePool

File: /Konquadrat/src/Object/InstancePool.php

Class hierarchy

Implements

Summary

Properties

$active

protected InstancePool::$active = true

$instances


Methods

getInstances()

public InstancePool::getInstances (
void
): array

Get all cached abstractObject instances.

getObjectById()

Get the cached instance of an abstractObject.

Parameters
$id : int
 
Exceptions

Throws UnknownObjectException If the object isn't in the cache.

hasInstance()

public InstancePool::hasInstance (
int $id
): bool

Checks whether an instance of the abstractObject is in the cache.

Parameters
$id : int
 

isActive()

public InstancePool::isActive (
void
): bool

Returns whether the instance pool is active.

reset()

Reset cached instances and activates the instance pool (if inactive).

resetObject()

Reset a single cached instance.

It will not be checked whether this instance exists.

Parameters
$id : int
 

setActive()

public InstancePool::setActive (
bool $flag = true
): InstancePoolInterface

Set the flag whether the instance pool caches the abstractObject.

Parameters
$flag : bool
 

setObject()

Enforces an instance for an object id if the pool is active and the object has an id.

Parameters
$object : AbstractObjectInterface