Skip to content

Commit

Permalink
[Jobs] Fix event triggering.
Browse files Browse the repository at this point in the history
  • Loading branch information
TiSiE committed Apr 9, 2018
1 parent cc65301 commit 59407fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions module/Jobs/src/Jobs/Controller/ManageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ public function approvalAction()
$jobEvent = $this->jobEvent;
$jobEvent->setJobEntity($jobEntity);
$jobEvent->addPortal('XingVendorApi');
$jobEvent->setTarget($this);
$jobEvents = $this->jobEvents;
// array with differences between the last snapshot and the actual entity
// is remains Null if there is no snapshot
Expand Down Expand Up @@ -580,7 +581,9 @@ public function approvalAction()
}

$this->repositoryService->store($jobEntity);
$jobEvents->trigger(JobEvent::EVENT_JOB_REJECTED, $jobEvent);
$jobEvent->setName(JobEvent::EVENT_JOB_REJECTED);

$jobEvents->trigger($jobEvent);
$this->notification()->success(/*@translate */'Job has been rejected');
}

Expand All @@ -594,7 +597,8 @@ public function approvalAction()
}
$jobEntity->changeStatus(Status::ACTIVE, sprintf(/*@translate*/ "Job opening was activated by %s", $user->getInfo()->getDisplayName()));
$this->repositoryService->store($jobEntity);
$jobEvents->trigger(JobEvent::EVENT_JOB_ACCEPTED, $jobEvent);
$jobEvent->setName(JobEvent::EVENT_JOB_ACCEPTED);
$jobEvents->trigger($jobEvent);
//$this->entitySnapshot($jobEntity);
$this->notification()->success(/* @translate */ 'Job has been approved');
return $this->redirect()->toRoute('lang/admin/jobs', array('lang' => $this->params('lang')));
Expand Down
6 changes: 3 additions & 3 deletions module/Jobs/src/Jobs/Listener/MailSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ public function onJobCreated(JobEvent $e)
*/
public function onJobAccepted(JobEvent $e)
{
$target = $e->getTarget();


$this->sendMail(
$target->getJobEntity(),
$e->getJobEntity(),
'mail/job-accepted',
/*@translate*/ 'Your job has been published'
);
Expand All @@ -123,7 +123,7 @@ public function onJobAccepted(JobEvent $e)
public function onJobRejected(JobEvent $e)
{
$this->sendMail(
$e->getTarget()->getJobEntity(),
$e->getJobEntity(),
'mail/job-rejected',
/*@translate*/ 'Your job has been rejected'
);
Expand Down

1 comment on commit 59407fa

@cbleek
Copy link
Member

@cbleek cbleek commented on 59407fa Apr 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TiSiE it seems, that this commit breaks our Tests

https://travis-ci.org/cross-solution/YAWIK/builds/364144006

Please sign in to comment.