尝试使用Categories
作为refClass将Websites
与WebsiteCategory
相关联。
WebsiteCategory
有一列rank
,表示在您致电$website->getCategories()
我很难过,没想到会这么难。有人可以帮忙吗?
答案 0 :(得分:1)
无法让学说本地订购关系(就像Damien所建议的那样),而是将getCategories()函数添加到运行正确查询并返回结果集的模型中。
答案 1 :(得分:1)
多对多关系不支持这种情况,下面将错误报告与可能的补丁相关联,尽管有些评论表明它无效。正如OP已经指出的那样,我认为解决方案是覆盖getCategories()函数。
答案 2 :(得分:0)
您可以在schema.yml中添加orderBy参数:
Gallery:
columns:
title: string(255)
relations:
Images:
local: id
foreign: gallery_id
foreignAlias: Gallery
type: many
orderBy: position DESC
您可以使用逗号添加多个字段。