IComment

interface OCP\Comments\IComment
Interface IComment
This class represents a comment
Implemented by:OC\Comments\Comment
Source:lib/public/Comments/IComment.php#36

Constants

MAX_MESSAGE_LENGTH = 1000
Source:lib/public/Comments/IComment.php#37

Methods

public OCP\Comments\IComment::getId()
returns the ID of the comment
It may return an empty string, if the comment was not stored.
It is expected that the concrete Comment implementation gives an ID
by itself (e.g. after saving).
Source:lib/public/Comments/IComment.php#49
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setId($id)
sets the ID of the comment and returns itself
It is only allowed to set the ID only, if the current id is an empty
string (which means it is not stored in a database, storage or whatever
the concrete implementation does), or vice versa. Changing a given ID is
not permitted and must result in an IllegalIDChangeException.
Source:

lib/public/Comments/IComment.php#64

Parameters:
  • $id (string)
Returns:

\OCP\Comments\IComment

Throws:

\OCP\Comments\IllegalIDChangeException

Since:

9.0.0

public OCP\Comments\IComment::getParentId()
returns the parent ID of the comment
Source:lib/public/Comments/IComment.php#72
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setParentId($parentId)
sets the parent ID and returns itself
Source:

lib/public/Comments/IComment.php#80

Parameters:
  • $parentId (string)
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getTopmostParentId()
returns the topmost parent ID of the comment
Source:lib/public/Comments/IComment.php#88
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setTopmostParentId($id)
sets the topmost parent ID and returns itself
Source:

lib/public/Comments/IComment.php#98

Parameters:
  • $id (string)
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getChildrenCount()
returns the number of children
Source:lib/public/Comments/IComment.php#106
Returns:int
Since:9.0.0
public OCP\Comments\IComment::setChildrenCount($count)
sets the number of children
Source:

lib/public/Comments/IComment.php#115

Parameters:
  • $count (int)
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getMessage()
returns the message of the comment
Source:lib/public/Comments/IComment.php#123
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setMessage($message, $maxLength=self::MAX_MESSAGE_LENGTH)
sets the message of the comment and returns itself
When the given message length exceeds MAX_MESSAGE_LENGTH an
MessageTooLongException shall be thrown.
Source:

lib/public/Comments/IComment.php#137

Parameters:
  • $message (string)
  • $maxLength (int)
Returns:

\OCP\Comments\IComment

Throws:

\OCP\Comments\MessageTooLongException

Since:

9.0.0 - $maxLength added in 16.0.2

public OCP\Comments\IComment::getMentions()
returns an array containing mentions that are included in the comment
Source:

lib/public/Comments/IComment.php#159

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 OCP\Comments\IComment::getVerb()
returns the verb of the comment
Source:lib/public/Comments/IComment.php#167
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setVerb($verb)
sets the verb of the comment, e.g. ‘comment’ or ‘like’
Source:

lib/public/Comments/IComment.php#176

Parameters:
  • $verb (string)
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getActorType()
returns the actor type
Source:lib/public/Comments/IComment.php#184
Returns:string
Since:9.0.0
public OCP\Comments\IComment::getActorId()
returns the actor ID
Source:lib/public/Comments/IComment.php#192
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setActor($actorType, $actorId)
sets (overwrites) the actor type and id
Source:

lib/public/Comments/IComment.php#202

Parameters:
  • $actorType (string) e.g. ‘users’
  • $actorId (string) e.g. ‘zombie234’
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getCreationDateTime()
returns the creation date of the comment.
If not explicitly set, it shall default to the time of initialization.
Source:lib/public/Comments/IComment.php#212
Returns:\DateTime
Since:9.0.0
public OCP\Comments\IComment::setCreationDateTime($dateTime)
sets the creation date of the comment and returns itself
Source:

lib/public/Comments/IComment.php#221

Parameters:
  • $dateTime (DateTime)
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getLatestChildDateTime()
returns the date of the most recent child
Source:lib/public/Comments/IComment.php#229
Returns:\DateTime
Since:9.0.0
public OCP\Comments\IComment::setLatestChildDateTime($dateTime)
sets the date of the most recent child
Source:

lib/public/Comments/IComment.php#238

Parameters:
  • $dateTime (DateTime)
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getObjectType()
returns the object type the comment is attached to
Source:lib/public/Comments/IComment.php#246
Returns:string
Since:9.0.0
public OCP\Comments\IComment::getObjectId()
returns the object id the comment is attached to
Source:lib/public/Comments/IComment.php#254
Returns:string
Since:9.0.0
public OCP\Comments\IComment::setObject($objectType, $objectId)
sets (overwrites) the object of the comment
Source:

lib/public/Comments/IComment.php#264

Parameters:
  • $objectType (string) e.g. ‘files’
  • $objectId (string) e.g. ‘16435’
Returns:

\OCP\Comments\IComment

Since:

9.0.0

public OCP\Comments\IComment::getReferenceId()
returns the reference id of the comment
Source:lib/public/Comments/IComment.php#272
Returns:string | null
Since:19.0.0
public OCP\Comments\IComment::setReferenceId($referenceId)
sets (overwrites) the reference id of the comment
Source:

lib/public/Comments/IComment.php#281

Parameters:
  • $referenceId (string | null) e.g. sha256 hash sum
Returns:

\OCP\Comments\IComment

Since:

19.0.0