Created
November 18, 2015 06:52
-
-
Save cod3beat/539f7834f10eea2bdacd to your computer and use it in GitHub Desktop.
PublishUnpublishedChallengeHandler.php tanpa tugas sekunder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PublishUnpublishedChallengeHandler | |
{ | |
public function handle(PublishUnpublishedChallenge $command) | |
{ | |
try { | |
DB::beginTransaction(); | |
$publishedChallenge = $this->challengePublicationContext->publishUnpublishedChallenge($command->challenge_id); | |
DB::commit(); | |
} catch (Exception $e) { | |
DB::rollback(); | |
throw $e; | |
} | |
// Dispatch Domain Event | |
$this->dispatchEventsFor($publishedChallenge); | |
return new PublishUnpublishedChallengeResponse($publishedChallenge); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment