【发布时间】:2011-04-29 15:15:01
【问题描述】:
我将 symfony 1.4.11 与学说一起使用。这是我的一张表:
Subscriptions:
connection: doctrine
tableName: subscriptions
columns:
user_id: { type: integer(4), primary: true }
category_id: { type: integer(4), primary: true }
relations:
sfGuardUser: { onDelete: CASCADE, local: user_id, foreign: id }
Categories: { onDelete: CASCADE, local: category_id, foreign: category_id }
我需要从这个表中获取所有的 user_id。
我做:
public function getSubscriptionsUser()
{
$q = $this->createQuery('a')
->select ('a.user_id');
return $q-> execute();
}
但是如果用户订阅了几个分类,它的id会重复几次。是否可以仅提取用户的唯一 ID?如果用户有 id = 1 ,并且重复 10 次,结果我将只有 "1" ,但没有 "1 1 1 1 1 1 1 1 1 1" :-) 谢谢!
【问题讨论】:
标签: symfony1 doctrine symfony-1.4