PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Uldis Nelsons  >  D3 PHP Activity Log  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: D3 PHP Activity Log
Track of changes in objects of given model objects
Author: By
Last change:
Date: 9 months ago
Size: 1,963 bytes
 

Contents

Class file image Download

Activity registry"

Registre models activities and get activity lists

Features

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require d3yii2/d3activity "*"

or add

"d3yii2/d3activity": "*"

to the require section of your composer.json file.

defining components

    'components' => [
        'activityList' => [
            'class' => 'd3yii2\d3activity\components\D3ActivityList',
            'sysCompanyId' => static function () {
                return \Yii::$app->SysCmp->getActiveCompanyId();
            },
            'models' => [
                [
                    'class' => 'd3modules\d3invoices\models\InvInvoice',
                    'detailClass' => 'd3modules\d3invoices\components\InvInvoiceD3Activity'
                ]
            ],
        ],
        'activityRegistar' => [
            'class' => 'd3yii2\d3activity\components\DbActivityRegistar',
            'sysCompanyId' => static function () {
                return \Yii::$app->SysCmp->getActiveCompanyId();
            },
            'userId' => static function () {
                return \Yii::$app->user->id;
            }            
            
        ],
    ]

Usage

Registr eactivity

    Yii::$app
        ->activityRegistar
        ->registerModel(
            $model,
            $this->route,
            ArrayHelper::filter($deliveryModel->attributes,[
                'recipient_person'
            ])
        );

Get activity record list

        $sysModelIdA = SysModelsDictionary::getIdByClassName(TestModel::class);
        $sysModelIdB = SysModelsDictionary::getIdByClassName(self::TEST_CLASS_NAME);
        Yii::$app->activityList->filter = [ActivityConfig::PARTNER_ID => 44];
        $list = Yii::$app
            ->activityList
            ->getDescList([$sysModelIdA,$sysModelIdB]);

Examples

For more information send a message to info at phpclasses dot org.