承接 diiimonn/yii2-behavior-relation-follow 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-02-04