Lets see if I can explain this (i'm going to use psuedo-code):
I have a couple entities:
A {
Bs: OneToMany(B, fetch=eager)
}
B {
A: ManyToOne(A)
}
so I'm running a query:
select B,A from B_table join A (B.A) where B.something = whatever
Now, this all comes back with my array filled with B's and A's correctly.
everything there is fine.
The problem is with the eager fetching on A.Bs.
When the A entity is being created it's running a query to load the A.B
entities, which is as expected because the annotation says "fetch=eager"
However, in my query I have explicitly done the following:
$query->setFetchMode(A::class,'Bs','LAZY');
but it's still running the queries to populate the A.Bs.
So... before bothering anyone, I stepped though the code in my debugger and
saw:
if ($assoc['fetch'] == ClassMetadata::FETCH_EAGER) {
$this->loadCollection($pColl);
$pColl->takeSnapshot();
}
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L2763
I do see however that in the $hints var:
$hints['fetchMode']['A']['Bs'] = 2 // 2 is FETCH_LAZY
So, it would seem to me that this is a bug as the hints are being ignored
in this case.
I just wanted to ask here before filing an issue and working on a fix.
--
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.