php - doctrine query for chained one-to-many relationships -
I have three tables, A, B, C and B have one-to-many relations in B and C There are many relationships from one and the other, in another word, each A can have more than one BS, while many B. May be.
Now I want to do a query for the record given by A to get all BS related to C. . In other words, for a given A, which is a record in Table A, I want to get all related B related to Table B, so that in each BS, table C is more than zero related C.
How to write statements in PHP theory? I have some code that does not work:
Doctrine_Query :: create () -> from ('bb') -> bayangon ('cc') -> and where ('b. A_ID =? ', A.id) -> and where (' c.b_id = b.id ');
with foo, bar and hawk (respectively A, B and C):
< Pre> doctoral-excel :: forming () - & gt; ('Repeatedly') - & gt; Where ('bar.foo_id =?', $ Foo- & gt; ID) - & gt; Inner joan ('barge falcon');
In this way you will find only times that are related to Foo, and which are one or several falcons.
Comments
Post a Comment