Neos.Neos/Classes/EventLog/Integrations/EntityIntegrationService.php
public function onFlush(OnFlushEventArgs $eventArgs)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        $entityManager = $eventArgs->getEntityManager();
        $unitOfWork = $entityManager->getUnitOfWork();

        foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) {
            $className = get_class($entity);
            if (isset($this->monitorEntitiesSetting[$className])) {
                $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className];

                if (isset($entityMonitoringConfiguration['events']['created'])) {
                    $data = [];
                    foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) {
                        $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]);
                    }

                    $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['created'], $data);
                    $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event);
                }
            }
        }

        foreach ($unitOfWork->getScheduledEntityDeletions() as $entity) {
            $className = get_class($entity);
            if (isset($this->monitorEntitiesSetting[$className])) {
                $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className];

                if (isset($entityMonitoringConfiguration['events']['deleted'])) {
                    $data = [];
                    foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) {
                        $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]);
                    }

                    $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['deleted'], $data);
                    $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event);
                }
            }
        }
    }
public function onFlush(OnFlushEventArgs $eventArgs)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        $entityManager = $eventArgs->getEntityManager();
        $unitOfWork = $entityManager->getUnitOfWork();

        foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) {
            $className = get_class($entity);
            if (isset($this->monitorEntitiesSetting[$className])) {
                $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className];

                if (isset($entityMonitoringConfiguration['events']['created'])) {
                    $data = [];
                    foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) {
                        $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]);
                    }

                    $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['created'], $data);
                    $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event);
                }
            }
        }

        foreach ($unitOfWork->getScheduledEntityDeletions() as $entity) {
            $className = get_class($entity);
            if (isset($this->monitorEntitiesSetting[$className])) {
                $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className];

                if (isset($entityMonitoringConfiguration['events']['deleted'])) {
                    $data = [];
                    foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) {
                        $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, ['entity' => $entity]);
                    }

                    $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['deleted'], $data);
                    $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event);
                }
            }
        }
    }
public function onFlush ( OnFlushEventArgs $ eventArgs ) { if ( ! $ this -> eventEmittingService -> isEnabled ( ) ) { return ; } $ entityManager = $ eventArgs -> getEntityManager ( ) ; $ unitOfWork = $ entityManager -> getUnitOfWork ( ) ; foreach ( $ unitOfWork -> getScheduledEntityInsertions ( ) as $ entity ) { $ className = get_class ( $ entity ) ; if ( isset ( $ this -> monitorEntitiesSetting [ $ className ] ) ) { $ entityMonitoringConfiguration = $ this -> monitorEntitiesSetting [ $ className ] ; if ( isset ( $ entityMonitoringConfiguration [ 'events' ] [ 'created' ] ) ) { $ data = [ ] ; foreach ( $ entityMonitoringConfiguration [ 'data' ] as $ key => $ eelExpression ) { $ data [ $ key ] = Utility :: evaluateEelExpression ( $ eelExpression , $ this -> eelEvaluator , [ 'entity' => $ entity ] ) ; } $ event = $ this -> eventEmittingService -> emit ( $ entityMonitoringConfiguration [ 'events' ] [ 'created' ] , $ data ) ; $ unitOfWork -> computeChangeSet ( $ entityManager -> getClassMetadata ( Event :: class ) , $ event ) ; } } } foreach ( $ unitOfWork -> getScheduledEntityDeletions ( ) as $ entity ) { $ className = get_class ( $ entity ) ; if ( isset ( $ this -> monitorEntitiesSetting [ $ className ] ) ) { $ entityMonitoringConfiguration = $ this -> monitorEntitiesSetting [ $ className ] ; if ( isset ( $ entityMonitoringConfiguration [ 'events' ] [ 'deleted' ] ) ) { $ data = [ ] ; foreach ( $ entityMonitoringConfiguration [ 'data' ] as $ key => $ eelExpression ) { $ data [ $ key ] = Utility :: evaluateEelExpression ( $ eelExpression , $ this -> eelEvaluator , [ 'entity' => $ entity ] ) ; } $ event = $ this -> eventEmittingService -> emit ( $ entityMonitoringConfiguration [ 'events' ] [ 'deleted' ] , $ data ) ; $ unitOfWork -> computeChangeSet ( $ entityManager -> getClassMetadata ( Event :: class ) , $ event ) ; } } } }
Record events for entity changes.

Note: this method is registered as an Doctrine event listener in the settings of this package.

TODO: Update/Delete of Entities

@param OnFlushEventArgs $eventArgs
@return void
@throws Exception
Record events for entity changes .