diiimonn/yii2-behavior-relation-follow
最新稳定版本:v1.0.0
Composer 安装命令:
composer require diiimonn/yii2-behavior-relation-follow
包简介
README 文档
README
Model behavior for relation data management
Installation
To install with composer:
$ php composer.phar require diiimonn/yii2-behavior-relation-follow "dev-master"
or add
"diiimonn/yii2-behavior-relation-follow": "dev-master"
to the require section of your composer.json file.
Usage
in MyModel.php
... use diiimonn\behaviors\RelationFollowBehavior; ... public function behaviors() { return [ ... [ 'class' => RelationFollowBehavior::className(), 'relations' => [ 'books', // relation name ] ], ]; } public function getBooks() { return $this->hasMany(BookModel::className(), ['id' => 'book_id'])->via('authorBooks'); } public function getAuthorBooks() { return $this->hasMany(AuthorBooks::className(), ['author_id' => 'id']); } ...
in my-view/_form.php
Select multiple from relation model. Recommended use yii2-widget-checkbox-multiple
统计信息
- 总下载量: 80
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-02-04