/** * * Creates a new User report. * * @param ReportComment $firstComment The first report comment for this report. * * @return object */ public function createPostReport(ReportComment $firstComment) { $user =& $this->getCurrentUser(); $firstComment->setAuthor($user); $report = $this->objectManager->get('Mittwald\\Typo3Forum\\Domain\\Model\\Moderation\\PostReport'); $report->setWorkflowStatus($this->getInitialWorkflowStatus()); $report->setReporter($user); $report->addComment($firstComment); return $report; }
/** * createPostReportCommentAction * * @param PostReport|NULL $report * @param ReportComment $comment * * @return void * @throws InvalidArgumentValueException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException */ public function createPostReportCommentAction(PostReport $report = NULL, ReportComment $comment) { // Assert authorization $this->authenticationService->assertModerationAuthorization($report->getTopic()->getForum()); // Validate arguments if ($report === NULL) { throw new InvalidArgumentValueException("You need to comment a user report!", 1285059341); } $comment->setAuthor($this->authenticationService->getUser()); $report->addComment($comment); $this->reportRepository->update($report); $this->controllerContext->getFlashMessageQueue()->enqueue(new FlashMessage(Localization::translate('Report_NewComment_Success'))); $this->clearCacheForCurrentPage(); $this->redirect('editReport', NULL, NULL, array('postReport' => $report)); }
/** * Adds a comment to this report. * * @param ReportComment $comment A comment * * @return void */ public function addComment(ReportComment $comment) { $comment->setReport($this); $this->comments->attach($comment); }