[eluser]Dracos[/eluser]
I've got two models, let's call them A and B, in a one to many relationship (A has one B, B has many A's).
The A_B table has extra fields, including A_B.foo.
I know that I can do this:
Code:
$a = new A($id);
$a->b->include_join_fields()->get()
The result is all the fields of B plus the join fields, because the query begins
Code:
SELECT B.*, A_B.id as join_id, A_B.foo as join_foo [...]
My question: is there a way, having instantiated A, to get the A fields with the join fields, and not reference B at all? Such as
Code:
$a = new A($id);
// some code
// resulting query
// SELECT A.*, A_B.id as join_id, A_B.foo as join_foo [...]
The reason I ask is that I will be dealing with sizable sets of $a->get() results where I want to include the A_B join fields, but I don't actually want the B fields, or to even instantiate B.