php - Doctrine2 - adding relationship to relationship -


assuming have 3 entities: article, tag & user. articles , tags many-to-many related.

what i'd add user information many-to-many relationship - can tell user added tag article. basically, result in sql should third column 'user_id' in article_tags (the many-to-many relationship table containing article_id , tag_id keys) can query for.

right i'm aware of 1 solution: creating fourth entity 'articletags' has 3 relationship fields article, tag , user. showing tags in article becomes...

<?php foreach($article->getarticletags() $articletag) {     echo $articletag->gettag()->getname() } 

...which less straight-forward $article->gettags() already, plus requires kinds of repository trickery querying, sorting , forth.

is there more ideal solution kind of thing? i'm using doctrine 2.1.0-dev right now. thanks.

imo, think articletags entity approach.

alternatively, if user entity has associations articles , tags, should able map out user entity tags belong post specific user.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -