2amigos / yii2-arrayquery-component
此包已废弃且不再维护。未建议替代包。
允许搜索/过滤数组元素的Yii2组件。
1.0.3
2017-07-05 10:05 UTC
Requires
- yiisoft/yii2: ~2.0.11
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- phpunit/phpunit: ~5.6
- scrutinizer/ocular: ~1.1
README
允许搜索/过滤数组。此组件在用ArrayDataProvider在GridView中显示数组数据时非常有用。
安装
通过 composer 安装此扩展是首选方式。
运行以下命令
php composer.phar require "2amigos/yii2-arrayquery-component" "*"
或在您的应用程序的 composer.json
文件的 require 部分添加以下内容
"2amigos/yii2-arrayquery-component" : "*"
。
使用
\\ $models is the array elements to used with ArrayDataProvider
$query = new ArrayQuery($models);
$models = $query
->addCondition('name', '~2amigos')
->addCondition('name', 'cebe/yii2-gravatar', 'or')
->find();
$dataProvider = new ArrayDataProvider([
'allModels' => $models,
'pagination' => [
'pageSize' => 50,
],
'sort' => [
'attributes' => [], // to be specified
],
]);
测试
$ phpunit
贡献
有关详细信息,请参阅 CONTRIBUTING。
致谢
许可
BSD许可(BSD)。有关更多信息,请参阅 许可文件。
定制软件 | 网络与移动软件开发 www.2amigos.us