#1467: REGRESSION: Problem with many-to-many
------------------------------+---------------------------------------------
  Reporter:  colnector        |       Owner:  romanb               
      Type:  defect           |      Status:  new                  
  Priority:  critical         |   Milestone:  1.0.3                
 Component:  Query/Hydration  |     Version:  1.0.0                
Resolution:                   |    Keywords:                       
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+---------------------------------------------
Comment (by romanb):

 I still can't really follow along this problem as I dont understand your
 class design. Maybe it would help if i can see all 4 classes involved
 (Item, Picture, ItemPicture, Puzzle). Is ItemPicture -> Puzzle a to-one or
 to-many association, eg. does an itempicture belong to 1 puzzle or to many
 puzzles? Why does Puzzle have an item_id?

 I would assume something like this out of my understanding of puzzles
 where an item can only belong to one puzzle:

 Classes: Puzzle (id,...), Item(id, puzzle_id, picture_id, ...),
 Picture(id,...)

 A Puzzle has many Items (one-many, uni-directional)
 An Item has one Picture (one-one, uni-directional)

 Now if I want all pictures of a Puzzle with a certain id i would do this
 fetch join:

 {{{
 select p.*, i.id, pic.* from Puzzle p inner join p.items i inner join
 i.picture pic where p.id = ?
 ...
 foreach ($p->items as $item) {
     // do sth with $item->picture
 }
 }}}

 If I would want to make the associations bidirectional (a Picture knows
 it's Item and the Item knows it's Puzzle) i could join the associations
 from the other side like this:

 {{{
 select pic.* from Picture p inner join p.Item i inner join i.puzzle puzz
 where puzz.id = ?
 ...
 foreach ($pictures as $pic) {
     // do sth with $pic
 }
 }}}

 Sorry if this is not what you want but i'm just trying to make sense of
 it.

-- 
Ticket URL: <http://trac.phpdoctrine.org/ticket/1467#comment:13>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to