Last active
November 18, 2015 07:01
-
-
Save cod3beat/ca3acf4254ae641f4dc1 to your computer and use it in GitHub Desktop.
Contoh Mempublikasikan sebuah unpublished challenge
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 ChallengePublicationContext | |
{ | |
public function publishUnpublishedChallenge($challengeId) | |
{ | |
// Jalankan logika bisnis yang berhubungan dengan | |
// proses mempublikasikan unpublised challenge | |
// Bila sukses, maka kita tambahkan Challenge ini ke | |
// koleksi Published Challenge | |
$this->publishedChallengeRepository->add($challenge); | |
// Karena challenge ini sudah dipublikasikan, maka kita | |
// bangkitkan domain event yang berhubungan dengan kejadian | |
// ini | |
$challenge->raise(new UnpublishedChallengeWasPublished($challenge->getId())); | |
return $challenge; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment