CActiveRecord returns NULL for lazy loaded objects that were not found (f.i. because the BELONGS_TO relation is/was optional). This triggers an error when properties of the related object are accessed without checking. Would it make sense to create new objects and return these instead?
When creating a new CActiveRecord would it make sense to automatically create new empty instances for all defined BELONGS_TO classes?
Would it make sense to opt for this kind of behaviour when defining the relations() for a CActiveRecord class?
I already did this the same a you do: testing for NULL in the load-function and then creating empty instances myself. I don’t think this is very transparant though. One would expect empty instances. Besides, you don’t want to be bothered testing for NULL values all the time.