public function deleteComment(Comment $c, ICommentable $e) { try { $wpDb = $this->wallDao->find($e->getId()); if ($wpDb !== null) { $coll = $wpDb->getComments(); $id = $c->getId(); $comment = $coll->filter(function ($e) use($id) { return $e->getId() == $id; })->first(); $index = $coll->indexOf($comment); $coll->remove($index); $this->entityManager->merge($wpDb); $this->entityManager->flush($wpDb); $this->commentService->deleteComment($c->getId()); $this->invalidateEntityCache($wpDb); } } catch (Exception $ex) { $this->logError($ex->getMessage()); throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }
private function authorTypeHandle(Comment $a) { if ($a === null) { throw new Exceptions\NullPointerException("Argument Event cannot be null", 0); } try { $author = null; if ($this->getUserService() !== null) { $id = $this->getMixId($a->getAuthor()); if ($id !== null) { $author = $this->getUserService()->getUser($id, false); } } $a->setAuthor($author); } catch (\Exception $ex) { throw new Exceptions\DataErrorException($ex); } }