yiisoft/yii2-collection
Composer 安装命令:
composer require yiisoft/yii2-collection
包简介
Active Record Collection implementation for the Yii framework
README 文档
README
ActiveRecord Collection Extension for Yii 2
This extension provides a generic data collection as well as a collection for the ActiveRecord DB layer of Yii 2.
Development is currently in experimental state. It is not ready for production use and may change significantly.
For license information check the LICENSE-file.
Documentation is at docs/guide/README.md.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yiisoft/yii2-collection
or add
"yiisoft/yii2-collection": "~1.0.0"
to the require section of your composer.json.
Configuration
To use this extension, you have to attach the yii\collection\CollectionBehavior to the ActiveQuery instance of
your ActiveRecord classes by overriding the find() method:
/** * {@inheritdoc} * @return \yii\db\ActiveQuery|\yii\collection\CollectionBehavior */ public static function find() { $query = parent::find(); $query->attachBehavior('collection', \yii\collection\CollectionBehavior::class); return $query; }
统计信息
- 总下载量: 3.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 68
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-05-15