Skip to content
Permalink
Browse files

[Applications] Fix: JobReferenceUpdateListeners does not check for u…

…nset users.
  • Loading branch information
TiSiE committed Oct 1, 2019
1 parent 82588e6 commit 57b2916a7b590b65cc704ee17fdb8c1f696311b8
Showing with 10 additions and 5 deletions.
  1. +10 −5 module/Applications/src/Repository/Event/JobReferencesUpdateListener.php
@@ -28,7 +28,7 @@ public function getSubscribedEvents()
{
return array(Events::preUpdate);
}

/**
* updates references
*
@@ -42,12 +42,17 @@ public function preUpdate(LifecycleEventArgs $eventArgs)
}
$dm = $eventArgs->getDocumentManager();
$changeset = $dm->getUnitOfWork()->getDocumentChangeset($document);

if (!isset($changeset['user'])) {


/* Somehow it could be that a changeset is produced, where the user
* is not actually changed - we check for it here */
if (!isset($changeset['user']) || $changeset['user'][0] === $changeset['user'][1]) {
return;
}

$userId = $document->getUser()->getId();

/* User could have gotten unset! */
$user = $document->getUser();
$userId = $user ? $user->getId() : null;

$dm->createQueryBuilder('Applications\Entity\Application')
->update()->multiple(true)

0 comments on commit 57b2916

Please sign in to comment.
You can’t perform that action at this time.