Merge pull request #16177 from nextcloud/backport/16175/stable16
[stable16] Allow apps to overwrite the maximum length when reading from database
This commit is contained in:
commit
3402e620b4
|
@ -98,6 +98,15 @@ class Manager implements ICommentsManager {
|
||||||
return $data;
|
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
|
* prepares a comment for an insert or update operation after making sure
|
||||||
* all necessary fields have a value assigned.
|
* all necessary fields have a value assigned.
|
||||||
|
@ -253,7 +262,8 @@ class Manager implements ICommentsManager {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment = new Comment($this->normalizeDatabaseData($data));
|
|
||||||
|
$comment = $this->getCommentFromData($data);
|
||||||
$this->cache($comment);
|
$this->cache($comment);
|
||||||
return $comment;
|
return $comment;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +318,7 @@ class Manager implements ICommentsManager {
|
||||||
|
|
||||||
$resultStatement = $query->execute();
|
$resultStatement = $query->execute();
|
||||||
while ($data = $resultStatement->fetch()) {
|
while ($data = $resultStatement->fetch()) {
|
||||||
$comment = new Comment($this->normalizeDatabaseData($data));
|
$comment = $this->getCommentFromData($data);
|
||||||
$this->cache($comment);
|
$this->cache($comment);
|
||||||
$tree['replies'][] = [
|
$tree['replies'][] = [
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
|
@ -367,7 +377,7 @@ class Manager implements ICommentsManager {
|
||||||
|
|
||||||
$resultStatement = $query->execute();
|
$resultStatement = $query->execute();
|
||||||
while ($data = $resultStatement->fetch()) {
|
while ($data = $resultStatement->fetch()) {
|
||||||
$comment = new Comment($this->normalizeDatabaseData($data));
|
$comment = $this->getCommentFromData($data);
|
||||||
$this->cache($comment);
|
$this->cache($comment);
|
||||||
$comments[] = $comment;
|
$comments[] = $comment;
|
||||||
}
|
}
|
||||||
|
@ -455,7 +465,7 @@ class Manager implements ICommentsManager {
|
||||||
|
|
||||||
$resultStatement = $query->execute();
|
$resultStatement = $query->execute();
|
||||||
while ($data = $resultStatement->fetch()) {
|
while ($data = $resultStatement->fetch()) {
|
||||||
$comment = new Comment($this->normalizeDatabaseData($data));
|
$comment = $this->getCommentFromData($data);
|
||||||
$this->cache($comment);
|
$this->cache($comment);
|
||||||
$comments[] = $comment;
|
$comments[] = $comment;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +495,7 @@ class Manager implements ICommentsManager {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
|
|
||||||
if ($row) {
|
if ($row) {
|
||||||
$comment = new Comment($this->normalizeDatabaseData($row));
|
$comment = $this->getCommentFromData($row);
|
||||||
$this->cache($comment);
|
$this->cache($comment);
|
||||||
return $comment;
|
return $comment;
|
||||||
}
|
}
|
||||||
|
@ -532,7 +542,7 @@ class Manager implements ICommentsManager {
|
||||||
$comments = [];
|
$comments = [];
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
while ($data = $result->fetch()) {
|
while ($data = $result->fetch()) {
|
||||||
$comment = new Comment($this->normalizeDatabaseData($data));
|
$comment = $this->getCommentFromData($data);
|
||||||
$this->cache($comment);
|
$this->cache($comment);
|
||||||
$comments[] = $comment;
|
$comments[] = $comment;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue