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

 So: Puzzle <- many-to-many -> Item <- many-to-many -> Picture. And i want
 to get all pictures of a puzzle.

 Again there are 2 straight-forward possibilities that are dictated by the
 class design:

 {{{
 Option 1: (Fetch) joining from puzzle to picture
 select p.*, i.id, pic.* from Puzzle p inner join p.items i inner join
 i.pictures where p.id = ?
 ...
 foreach ($puzzle->items as $item) {
     //do sth with $item->pictures
 }
 }}}

 {{{
 Option 2: (regular) joining from picture towards puzzle
 select pic.* from Picture pic inner join pic.items i inner join i.puzzles
 p where p.id = ?
 ...
 foreach ($pictures as $pic) {
     //do sth with $pic
 }
 }}}

 As it looks to me you want to join classes directly that are not directly
 associated with each other. DQL operates on your classes and their
 associations. You can't join arbitrary things like you can in SQL, that is
 by intention.

 That said, we plan to support a sort of implicit join as it is described
 in the JPA (1.0) spec:
 "... An inner join may be implicitly specified by the use of a cartesian
 product in the FROM clause and a join condition in the WHERE  clause..."
 But this will make it into 2.0 at the earliest and is certainly not a
 showstopper.

-- 
Ticket URL: <http://trac.phpdoctrine.org/ticket/1467#comment:16>
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