dmuratov/yii2-universal-comment

Universal comment for yii2 framework

dev-master / 1.0.x-dev 2016-01-14 13:52 UTC

This package is not auto-updated.

Last update: 2024-03-20 16:35:55 UTC


README

That library include Comment model and CommentBehaviour. It is simple and fast way to provide easy adding comments for others models.

Installation

The preferred way to install this extension is through composer.

Either run

composer require dmuratov/yii2-universal-comment:~1.0

or add

"dmuratov/yii2-universal-comment" : "~1.0"

to the require section of your application's composer.json file.

Usage

Adding behaviour for model:

public function behaviors()
{
    return [
        ...
        'comment' => [
            'class' => \dmuratov\comment\CommentBehaviour::className()
        ]
    ];
}

Adding comment for model


$model->addComment('Comment text');

Getting comments


$model->getComments()->all();