示例#1
0
 /**
  * Orchestrates the use-case of a speaker submitting a talk.
  *
  * @param TalkSubmission $submission
  *
  * @return Talk
  * @throws \Exception
  */
 public function submitTalk(TalkSubmission $submission)
 {
     if (!$this->callForProposal->isOpen()) {
         throw new \Exception('You cannot create talks once the call for papers has ended.');
     }
     $user = $this->identityProvider->getCurrentUser();
     // Create talk from submission.
     $talk = $submission->toTalk();
     // Own the talk to the speaker.
     $talk->user_id = $user->id;
     $this->talks->persist($talk);
     $this->dispatcher->dispatch('opencfp.talk.submit', new TalkWasSubmitted($talk));
     return $talk;
 }