This issue is continuation of issue #2488 from Trac. I have prepared Test case showing that the problem is seriously. Below original content.
A record gets STATE_PROXY state at hydration when its properties are not fully loaded. Here is a condition (placed in Doctrine_Record::hydrate()):
But at first setting a column value (whatever if the column value was loaded or not), the record gets STATE_DIRTY and "forgets" its proxy state.
In effect a call to any not loaded column of the record causes returning null value. It should, of course, load remaining column values and change record state from STATE_PROXY to STATE_DIRTY. It doesn't load because current record state is already STATE_DIRTY.
I'm attaching a patch, which fixes Doctrine_Record::load() in the described situation.
In my opinion usage of STATE_PROXY must be rethinked. STATE_PROXY can mean:
1. STATE_CLEAN + not fully loaded columns (proxy)
2. STATE_DIRTY + not fully loaded columns (proxy)
Currently it only points the first situation so there is not way to identify the second situation (and it is silently ignored).