class ObjectValidationAndDeDuplicationListener (View source)

An onFlush listener for Flow's Doctrine PersistenceManager.

Used to de-duplicate value objects and validate new and updated objects during flush.

Properties

protected ValidatorResolver $validatorResolver
protected ReflectionService $reflectionService
protected PersistenceManager $persistenceManager
protected EntityManagerInterface $entityManager

Methods

void
prePersist(PrePersistEventArgs $eventArgs)

An prePersist event listener to deduplicate value objects.

void
onFlush(OnFlushEventArgs $eventArgs)

An onFlush event listener used to act upon persistence.

Details

void prePersist(PrePersistEventArgs $eventArgs)

An prePersist event listener to deduplicate value objects.

This removes all existing value objects in doctrines identity map. This is needed as doctrine handles their identity based on the object and not based on the

Parameters

PrePersistEventArgs $eventArgs

Return Value

void

void onFlush(OnFlushEventArgs $eventArgs)

An onFlush event listener used to act upon persistence.

Parameters

OnFlushEventArgs $eventArgs

Return Value

void

Exceptions

ObjectValidationFailedException