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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -