Class humhub\modules\comment\models\Comment

Inheritancehumhub\modules\comment\models\Comment » humhub\modules\content\components\ContentAddonActiveRecord » humhub\components\ActiveRecord » yii\db\ActiveRecord
ImplementsSerializable, humhub\modules\content\interfaces\ContentOwner
Available since version0.5

This is the model class for table "comment".

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$automaticContentFollowing boolean Automatic following of the addon creator to the related content humhub\modules\content\components\ContentAddonActiveRecord
$updateContentStreamSort boolean Also update underlying contents last update stream sorting humhub\modules\content\components\ContentAddonActiveRecord

Public Methods

Hide inherited methods

MethodDescriptionDefined By
GetCommentCount() Count number comments for this target object humhub\modules\comment\models\Comment
GetCommentsLimited() Returns a limited amount of comments humhub\modules\comment\models\Comment
afterDelete() humhub\modules\comment\models\Comment
afterSave() After Saving of comments, fire an activity humhub\modules\comment\models\Comment
beforeDelete() humhub\modules\comment\models\Comment
beforeSave() humhub\components\ActiveRecord
behaviors() humhub\modules\comment\models\Comment
canDelete() humhub\modules\comment\models\Comment
canRead() Check if current user can read this object humhub\modules\content\components\ContentAddonActiveRecord
canWrite() Checks if this content addon can be changed humhub\modules\content\components\ContentAddonActiveRecord
flushCache() Flush comments cache humhub\modules\comment\models\Comment
flushCommentCache() humhub\modules\comment\models\Comment
getCommentedRecord() Returns the commented record e.g. a Post humhub\modules\comment\models\Comment
getContent() Returns the content object to which this addon belongs to. humhub\modules\content\components\ContentAddonActiveRecord
getContentDescription() Returns a text preview of this content. humhub\modules\comment\models\Comment
getContentName() Returns a title for this type of content. humhub\modules\comment\models\Comment
getCreatedBy() Relation to User defined in created_by attribute humhub\components\ActiveRecord
getErrorMessage() Returns the errors as string for all attribute or a single attribute. humhub\components\ActiveRecord
getFileManager() Returns the file manager for this record humhub\components\ActiveRecord
getSource() Returns the source of this content addon. humhub\modules\content\components\ContentAddonActiveRecord
getUniqueId() Returns a unique id for this record/model humhub\components\ActiveRecord
getUpdatedBy() Relation to User defined in updated_by attribute humhub\components\ActiveRecord
getUser() humhub\modules\content\components\ContentAddonActiveRecord
rules() humhub\modules\comment\models\Comment
serialize() Serializes attributes and oldAttributes of this record. humhub\components\ActiveRecord
tableName() humhub\modules\comment\models\Comment
unserialize() Unserializes the given string, calls the init() function and sets the attributes and oldAttributes. humhub\components\ActiveRecord
validate() Validates humhub\modules\content\components\ContentAddonActiveRecord

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
updateContentSearch() Force search update of underlying content object. humhub\modules\comment\models\Comment

Method Details

GetCommentCount() public static method

Count number comments for this target object

public static integer|mixed|string GetCommentCount ( $model, $id )
$model
$id
GetCommentsLimited() public static method

Returns a limited amount of comments

public static humhub\modules\comment\models\Comment[] GetCommentsLimited ( $model, $id, $limit 2 )
$model
$id
$limit integer
return humhub\modules\comment\models\Comment[]

The comments

afterDelete() public method

public void afterDelete ( )
afterSave() public method

After Saving of comments, fire an activity

public boolean afterSave ( $insert, $changedAttributes )
$insert boolean
$changedAttributes array
throws \yii\base\Exception
beforeDelete() public method

public void beforeDelete ( )
behaviors() public method

public void behaviors ( )
canDelete() public method

public void canDelete ( $userId '' )
$userId
flushCache() public method

Flush comments cache

public void flushCache ( )
flushCommentCache() public static method

public static void flushCommentCache ( $model, $id )
$model
$id
getCommentedRecord() public method

Returns the commented record e.g. a Post

public humhub\modules\content\components\ContentActiveRecord getCommentedRecord ( )
getContentDescription() public method

Returns a text preview of this content.

This method should be overwritten in the content implementation.

public string getContentDescription ( )
getContentName() public method

Returns a title for this type of content.

This method should be overwritten in the content implementation.

public string getContentName ( )
rules() public method

public array rules ( )
return array

Validation rules for model attributes.

tableName() public static method

public static void tableName ( )
updateContentSearch() protected method

Force search update of underlying content object.

(This has also indexed the comments.)

protected void updateContentSearch ( )