symfony1 - Symfony doctrine , unique records -
i use symfony 1.4.11 doctrine.this 1 of tables:
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 }
i need user_id table.
i make :
public function getsubscriptionsuser() { $q = $this->createquery('a') ->select ('a.user_id'); return $q-> execute(); }
but if user subscribed several categories, id repeated several times. possible extract unique id of user? if user have id = 1 , , repeated 10 times,in result have "1" , no "1 1 1 1 1 1 1 1 1 1" :-) thank you!
this should work out you:
$q = $this->createquery('a') ->select ('distinct(a.user_id) user_id');
Comments
Post a Comment