Hello,

I've currently a problem with filling an entity with the 
ResultsetMappingBuilder from a NativeQuery like a query from the Query 
Builder.
I have to use a NativeQuery since a subselect on a left join isn't possible 
with doctrine. Here is a very simplified version of my problem:

Table A
  - aID
  
Table B
  - bID 
  - aID

Table C 
  - cID
  - aID

Table D 
  - dID
  - bID
  - cID
  - date
  unique on bID, cID, date

Table E  
  - eID
  - bID
  - CID
  - date
  unique on bID, cID, date

Table F 
  - fID
  - bID
  - cID
  - date
  unique on bID, cID, date


the native query:

select A.*, B.*, C.*, D.*, E.*, F.* from A
inner join B on B.aID = A.aID
inner join D on D.bID = B.bID
inner join C on C.cID = D.cID
left join (select * from E as ESUB where ESUB.date >= startDate and 
ESUB.date <= endDate) as E on E.bID = B.bID
left join (select * from F as FSUB where FSUB.date >= startDate and 
FSUB.date <= endDate) as F on F.bID = B.bID
where D.date >= startDate and D.date <= endDate


With the ResultMappingBuilder  ($rsmb) i've created this map (also 
simplified):

$rsmb->addRootEntityFromClassMetadata(A, A_alias, A_mappings);
$rsmb->addJoinedEntityFromClassMetadata(B, B_alias, A_alias, B_mappings);
$rsmb->addJoinedEntityFromClassMetadata(D, D_alias, B_alias, D_mappings);
$rsmb->addJoinedEntityFromClassMetadata(C, C_alias, D_alias, C_mappings);
$rsmb->addJoinedEntityFromClassMetadata(E, E_alias, B_alias, E_mappings);
$rsmb->addJoinedEntityFromClassMetadata(F, F_alias, B_alias, F_mappings);


And exactly here my problem came in: i should have following object 
structure like a query from query builder:

A:
  - B[
      B1:
        - D[
            D1:
               - B1
               - C1
            D2
               - B1
               - C2
          ]
        - E[
            E1:
               - B1
               - C1
            E2
               - B1
               - C3
          ]
      B2
        - D[
            D3
               - B2
               - C1
            D4
               - B2
               - C3    
          ]
        - F[
            F1:
               - B2
               - C1
            F2
               - B2
               - C2
          ]
    ]
  - C[
      C1:
         - D[
             D1
             D3
           ]
         - E[
             E1:
               - B1
               - C1
           ]
         - F[
             F1:
               - B2
               - C1
           ]
      C2:
         - D[
             D2
           ]
         - F[
             F2:
               - B2
               - C2
           ]
      C3:
         - D[
             D4
           ]
         - E[
              E2:
                - B1
                - C3
           ]
    ]

But i've got the following:

A:
  - B[
      B1:
        - D[
            D1:
               - B1
               - C1
            D2
               - B1
               - C2
          ]
        - E[
            E1:
               - B1
               - NULL (should be C1)
            E2
               - B1
               - NULL (should be C3)
          ]
      B2
        - D[
            D3
               - B2
               - C1
            D4
               - B2
               - C3    
          ]
        - F[
            F1:
               - B2
               - NULL (should be C1)
            F2
               - B2
               - null (should be C2)
          ]
    ]
  - C[ completely missing ]


I believe this result in a missing addJoinResultMapping for E/F to C.
I've tried to add these, but this will overwrite the JoinResultMapping for 
E/F to B.



So how to get the correct result mapping?

(if it is to abstract, i've can create an example)

-- 
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