Comment¶
-
class
OC\Comments\
Comment
¶ Source: lib/private/Comments/Comment.php#33 Implements: OCP\Comments\IComment
Properties¶
-
protected static property
OC\Comments\Comment::$
data
¶ Source: lib/private/Comments/Comment.php#34
Methods¶
-
public
OC\Comments\Comment::
__construct
($data=null)¶ - Comment constructor.
Source: Parameters: - $data (array) optional, array with keys according to column names from
the comments database scheme
-
public
OC\Comments\Comment::
getId
()¶ - returns the ID of the commentIt may return an empty string, if the comment was not stored.It is expected that the concrete Comment implementation gives an IDby itself (e.g. after saving).
Source: lib/private/Comments/Comment.php#72 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setId
($id)¶ - sets the ID of the comment and returns itselfIt is only allowed to set the ID only, if the current id is an emptystring (which means it is not stored in a database, storage or whateverthe concrete implementation does), or vice versa. Changing a given ID isnot permitted and must result in an IllegalIDChangeException.
Source: Parameters: - $id (string)
Returns: Throws: Since: 9.0.0
-
public
OC\Comments\Comment::
getParentId
()¶ - returns the parent ID of the comment
Source: lib/private/Comments/Comment.php#109 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setParentId
($parentId)¶ - sets the parent ID and returns itself
Source: Parameters: - $parentId (string)
Returns: Since: 9.0.0
-
public
OC\Comments\Comment::
getTopmostParentId
()¶ - returns the topmost parent ID of the comment
Source: lib/private/Comments/Comment.php#134 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setTopmostParentId
($id)¶ - sets the topmost parent ID and returns itself
Source: Parameters: - $id (string)
Returns: Since: 9.0.0
-
public
OC\Comments\Comment::
getChildrenCount
()¶ - returns the number of children
Source: lib/private/Comments/Comment.php#160 Returns: int Since: 9.0.0
-
public
OC\Comments\Comment::
setChildrenCount
($count)¶ - sets the number of children
Source: Parameters: - $count (int)
Returns: Since: 9.0.0
-
public
OC\Comments\Comment::
getMessage
()¶ - returns the message of the comment
Source: lib/private/Comments/Comment.php#185 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setMessage
($message, $maxLength=self::MAX_MESSAGE_LENGTH)¶ - sets the message of the comment and returns itself
Source: Parameters: - $message (string)
- $maxLength (int)
Returns: Throws: Since: 9.0.0
-
public
OC\Comments\Comment::
getMentions
()¶ - returns an array containing mentions that are included in the comment
Source: Returns: array each mention provides a ‘type’ and an ‘id’, see example below
Since: 11.0.0 The return array looks like: [
- [
‘type’ => ‘user’, ‘id’ => ‘citizen4’
], [
‘type’ => ‘group’, ‘id’ => ‘media’
], …
]
-
public
OC\Comments\Comment::
getVerb
()¶ - returns the verb of the comment
Source: lib/private/Comments/Comment.php#257 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setVerb
($verb)¶ - sets the verb of the comment, e.g. ‘comment’ or ‘like’
Source: Parameters: - $verb (string)
Returns: Since: 9.0.0
-
public
OC\Comments\Comment::
getActorType
()¶ - returns the actor type
Source: lib/private/Comments/Comment.php#282 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
getActorId
()¶ - returns the actor ID
Source: lib/private/Comments/Comment.php#292 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setActor
($actorType, $actorId)¶ - sets (overwrites) the actor type and id
Source: Parameters: - $actorType (string) e.g. ‘users’
- $actorId (string) e.g. ‘zombie234’
Returns: Since: 9.0.0
-
public
OC\Comments\Comment::
getCreationDateTime
()¶ - returns the creation date of the comment.If not explicitly set, it shall default to the time of initialization.
Source: lib/private/Comments/Comment.php#324 Returns: \DateTime
Since: 9.0.0
-
public
OC\Comments\Comment::
setCreationDateTime
($timestamp)¶ - sets the creation date of the comment and returns itself
Source: Parameters: - $timestamp (
DateTime
)
Returns: Since: 9.0.0
- $timestamp (
-
public
OC\Comments\Comment::
getLatestChildDateTime
()¶ - returns the DateTime of the most recent child, if set, otherwise null
Source: lib/private/Comments/Comment.php#346 Returns: \DateTime
| nullSince: 9.0.0
-
public
OC\Comments\Comment::
setLatestChildDateTime
($dateTime=null)¶ - sets the date of the most recent child
Source: Parameters: - $dateTime (
DateTime
)
Returns: Since: 9.0.0
- $dateTime (
-
public
OC\Comments\Comment::
getObjectType
()¶ - returns the object type the comment is attached to
Source: lib/private/Comments/Comment.php#368 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
getObjectId
()¶ - returns the object id the comment is attached to
Source: lib/private/Comments/Comment.php#378 Returns: string Since: 9.0.0
-
public
OC\Comments\Comment::
setObject
($objectType, $objectId)¶ - sets (overwrites) the object of the comment
Source: Parameters: - $objectType (string) e.g. ‘files’
- $objectId (string) e.g. ‘16435’
Returns: Since: 9.0.0
-
public
OC\Comments\Comment::
getReferenceId
()¶ - returns the reference id of the comment
Source: lib/private/Comments/Comment.php#408 Returns: string | null Since: 19.0.0
-
public
OC\Comments\Comment::
setReferenceId
($referenceId)¶ - sets (overwrites) the reference id of the comment
Source: Parameters: - $referenceId (string) e.g. sha256 hash sum
Returns: Since: 19.0.0
-
protected
OC\Comments\Comment::
fromArray
($data)¶ - sets the comment data based on an array with keys as taken from thedatabase.
Source: Parameters: - $data (array)
Returns: