【发布时间】:2012-03-13 12:59:20
【问题描述】:
我在项目和资产之间建立了多对多关系,使用 ProjectAsset 类作为这 2 之间的中间类。当我在项目上使用 getProjectAsset() 方法时,它会返回分配给该项目的所有 ProjectAsset。
如何更改 schema.yml 以默认对结果进行排序?
Project:
relations:
Assets:
class: Asset
refClass: ProjectAsset
foreignAlias: Projects
local: project_id
foreign: asset_id
ProjectAsset:
tableName: projects_assets
columns:
title: { type: string, length: 255 }
project_id: { type: integer, primary: true }
asset_id: { type: integer, primary: true }
relations:
Project:
class: Project
foreignAlias: ProjectAssetRelations
local: project_id
foreign: id
onDelete: CASCADE
Asset:
class: Asset
foreignAlias: ProjectAssetRelations
local: asset_id
foreign: id
onDelete: CASCADE
【问题讨论】:
标签: orm symfony1 doctrine schema many-to-many