return $data;
}
+
+ /**
+ * @param array $data
+ * @return IComment
+ */
+ public function getCommentFromData(array $data): IComment {
+ return new Comment($this->normalizeDatabaseData($data));
+ }
+
/**
* prepares a comment for an insert or update operation after making sure
* all necessary fields have a value assigned.
throw new NotFoundException();
}
- $comment = new Comment($this->normalizeDatabaseData($data));
+
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
return $comment;
}
$resultStatement = $query->execute();
while ($data = $resultStatement->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$tree['replies'][] = [
'comment' => $comment,
$resultStatement = $query->execute();
while ($data = $resultStatement->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$comments[] = $comment;
}
$resultStatement = $query->execute();
while ($data = $resultStatement->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$comments[] = $comment;
}
$result->closeCursor();
if ($row) {
- $comment = new Comment($this->normalizeDatabaseData($row));
+ $comment = $this->getCommentFromData($row);
$this->cache($comment);
return $comment;
}
$comments = [];
$result = $query->execute();
while ($data = $result->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$comments[] = $comment;
}