/** * Returns the post pending comments * * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\T3extblog\Domain\Model\Comment> $comments */ public function getPostPendingComments() { if ($this->postPendingComments === NULL) { $postPendingComments = $this->getCommentRepository()->findPendingByEmailAndPostId($this->email, $this->postUid); $this->postPendingComments = new ObjectStorage(); foreach ($postPendingComments as $comment) { $this->postPendingComments->attach($comment); } } return $this->postPendingComments; }
/** * Removes a Comment * * @param \TYPO3\T3extblog\Domain\Model\Comment $commentToRemove The Comment to be removed * @return void */ public function removeComment(Comment $commentToRemove) { $this->initComments(); $commentToRemove->setDeleted(TRUE); $this->comments->detach($commentToRemove); $this->getCommentRepository()->update($commentToRemove); }