idealia / yii2-children-count-behavior
Behavior for counting records in the dependent objects and updating the relevant column after insert, edit and remove any child record.
Package info
github.com/Idealia/yii2-children-count-behavior
pkg:composer/idealia/yii2-children-count-behavior
dev-master
2016-02-16 13:12 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2026-03-14 23:43:16 UTC
README
Behavior for counting records in the dependent objects and updating the relevant column after insert, edit and remove any child record.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require idealia/yii2-children-count-behavior "*"
or add
"idealia/yii2-children-count-behavior": "*"
to the require section of your composer.json file.
Usage
public function behaviors() { return [ [ 'class' => ChildrenCountBehavior::className(), 'countRelation' => 'getDocuments', 'parentRelation' => 'getTask', 'columnToUpdate' => 'document_count' ], ]; }