Description
Doctrine entities can not be weaved - class metadata gets all messed up.
Engine generates Entity__AopProxied
, which is copy of original class, and then generates class Entity
that extends Entity__AopProxied
and contains weaved methods/properties.
Issue is that Entity__AopProxied
contains doctrine metadata, so Doctrine actually generates such metadata that Entity__AopProxied
is main class and every relation is bound to that class, not Entity
.
Side effects are that, per example, table name gets suffix "__aop_proixed", while relations gets all screwed up, so any join is broken because different aliases are generated with SQL walker. Lazy loading does not work as well.
Possible solution would be (in order to preserve BC compatibility) to provide possibility to specify different method of weaving for certain classes. Per example, in this case, in order to work as it should, Entity__AopProxied
should not be generated and inherited, it should be generated only Entity
class.
Yes, maybe we will loose nice debugging and breakpoints, however, for now, we can sacrifice that for working code.