承接 cornernote/yii2-linkall 相关项目开发

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

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

cornernote/yii2-linkall

最新稳定版本:1.0.0

Composer 安装命令:

composer require cornernote/yii2-linkall

包简介

Behavior to handle saving multiple many to many related records in Yii2.

README 文档

README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Behavior to handle saving multiple many to many related records in Yii2.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require cornernote/yii2-linkall "*" 

or add

"cornernote/yii2-linkall": "*" 

to the require section of your composer.json file.

Usage

Post Model

class Post extends ActiveRecord { public function behaviors() { return [ \cornernote\linkall\LinkAllBehavior::className(), ]; } public function getTags() { return $this->hasMany(Tag::className(), ['id' => 'tag_id']) ->viaTable('post_to_tag', ['post_id' => 'id']); //->via('postToTag'); } }

Tag Model

class Tag extends ActiveRecord { }

Post Controller

class PostController extends Controller { public function actionExample() { $post = Post::findOne(1); $tags = [Tag::findOne(2), Tag::findOne(3)]; $extraColumns = []; // extra columns to be saved to the many to many table $unlink = true; // unlink tags not in the list $delete = true; // delete unlinked tags $post->linkAll('tags', $tags, $extraColumns, $unlink, $delete); } }

统计信息

  • 总下载量: 94.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 25
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 25
  • Watchers: 5
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固