承接 bigfork/supergroupedlist 相关项目开发

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

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

bigfork/supergroupedlist

最新稳定版本:1.0.0

Composer 安装命令:

composer require bigfork/supergroupedlist

包简介

An extension of SilverStripe’s GroupedList that supports traversing relations

README 文档

README

Build Status Latest Stable Version Total Downloads License

An extension of SilverStripe’s GroupedList that supports traversing relations.

Note: depending on your data, the same items may be output multiple times. For example if a product belongs to multiple categories, and you group by category title, then the product will show under each of the categories that it belongs to.

Installation

composer require bigfork/supergroupedlist ^1.0

Or download and extract to a folder named supergroupedlist in your document root.

Usage

Use exactly as you would use GroupedList, but with dot-notation to traverse relations:

public function GroupedProducts() {
	$products = Product::get();
	return SuperGroupedList::create($products);
}
<% loop $GroupedProducts.GroupedBy('Categories.Title') %>
	<h1>{$Title}</h1><!-- Category title -->
	<ul>
		<% loop $Children %>
			<li>{$Title}</li><!-- Product title -->
		<% end_loop %>
	</ul>
<% end_loop %>

You can traverse has_one, has_many and many_many relations using dot notation. The last part of the notation you provide (Title in the example above) will be both the field that’s extracted from the final component, and the $Variable used to access that field inside the loop.

You can even traverse multiple relations at once. For example, $GroupedProducts.GroupedBy('Manufacturer.Employees.FavouriteTeam.Name') would return a list of products grouped by the names of the favourite teams of the employees of the product’s manufacturer.

统计信息

  • 总下载量: 238
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-06-09