class AllowedObjectsListener (View source)

An onFlush listener for Flow's Doctrine PersistenceManager, that validates to be persisted entities against the list of allowed objects.

This listener is outsourced from the PersistenceManager to avoid recursive dependencies when building the EntityManager.

Properties

protected LoggerInterface $logger
protected ThrowableStorageInterface $throwableStorage
protected AllowedObjectsContainer $allowedObjects
protected PersistenceManagerInterface $persistenceManager

Methods

void
onFlush(OnFlushEventArgs $args)

Doctrine onFlush listener that checks for only allowed objects and reconnects if the database connection was closed.

bool
ping(Connection $connection)

Execute a dummy query on the given connection and return false if the connection is not open

void
throwExceptionIfObjectIsNotAllowed(object $object)

Checks if the given object is allowed and if not, throws an exception

Details

void onFlush(OnFlushEventArgs $args)

Doctrine onFlush listener that checks for only allowed objects and reconnects if the database connection was closed.

Parameters

OnFlushEventArgs $args

Return Value

void

Exceptions

Exception

protected bool ping(Connection $connection)

Execute a dummy query on the given connection and return false if the connection is not open

Parameters

Connection $connection

Return Value

bool

protected void throwExceptionIfObjectIsNotAllowed(object $object)

Checks if the given object is allowed and if not, throws an exception

Parameters

object $object

Return Value

void

Exceptions

Exception