Difficult to work with records that haven't been saved to database

It's not always necessary to save all ORM instances to database right away, for example when something needs to be previewed and could only be saved to database at a later time. The ORM seems to have some issues with this. The related records don't really work at all if they haven't been saved to database.

Example code:

$parent = new TheParent();
$parent->name = 'The parent';

$child = new Child();
$child->name = 'test';
$parent->children = [$child];





array(0) {

Related thread with setup code: http://forum.phalconphp.com/discussion/2007/two-orm-issues

Whatever way you look at it, it's simply not right.

Am I the only one that has come across this problem? I have been really lazy with unit testing lately, but it seems that this issue itself would prevent ORM from being testable (unless the tests involve storing all records to database). I really hope I'm missing something. Currently I'm getting around this issue by saving the records to database at the beginning of the request and deleting when calculations are finished (and gone are any performance gains...)