Hi,

I have the following tables:

table user
- id
- name

table post: 
- id 
- name 

table label ({user_id , name} is unique): 
- id 
- user_id
- name 

The many to many relation table:
table post_label: 
- post_id
- label_id 



$userId = 10;
//Label that ID = 1
$label = $em->getRepository('LabelRepository')->find( 1 );
// Posts with Label ID = 1
$label->getPosts();

// My problem: What is the best way to get the list of Post with label_id = 
1 and each contain list of label with user_id = 1 only ?

$label->getPosts()[ 0 ... n ]->getLabels(); //But only user_id = 1

[ {
  id : 1,
  name : 'foobar',
  labels => [ {  id : 1,  user_id : 1, name :'foo' },{  id : 2,  user_id : 
1, name :'bar' } 
 }, 

....
]

Thank you.



-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to