0
我正在做一个使用symfony作为学习练习的博客引擎。如何访问链接到博客文章的标签列表?
如何从博客文章的ID中获取标签列表? 这里的数据库玛:
我加在模型如下:
public static function getTags($id)
{
return Doctrine_Core::getTable('Tag')
->createQuery('t')
->select('t.name, t.slug')
->leftJoin('t.ContentTag ct')
->where('ct.content_id = ?', $id)
->orderBy('t.name ASC');
}
这里是schema.yml中的一部分:
Content:
connection: doctrine
tableName: ec_content
actAs:
Sluggable:
fields: [title]
unique: true
canUpdate: true
Timestampable:
columns:
id:
type: integer(4)
fixed: false
unsigned: true
primary: true
autoincrement: true
(...)
relations:
Comment:
local: id
foreign: content_id
type: many
ContentTag:
local: id
foreign: content_id
type: many
ContentTag:
connection: doctrine
tableName: ec_content_tag
columns:
content_id:
type: integer(4)
fixed: false
unsigned: true
primary: true
autoincrement: false
tag_id:
type: integer(4)
fixed: false
unsigned: true
primary: true
autoincrement: false
relations:
Content:
local: content_id
foreign: id
type: one
Tag:
local: tag_id
foreign: id
type: one
我不知道“refClass”,谢谢! – Manu 2010-10-05 14:47:51