When accessing related records and if those records do not exists Doctrine automatically creates new records.
Accessing related records in Doctrine is easy: you can use exactly the same getters and setters as for the record properties.
You can use any of the three ways above, however the last one is the recommended one for array portability purposes.
<code type="php">
// NOTE: related record have always the first letter in uppercase
$email = $user->Email;
$user->Email;
$email->address = 'jackdaniels@drinkmore.info';
$user->get('Email');
$user->save();
$user['Email'];
</code>
// alternative:
When accessing a one-to-one related record that doesn't exist, Doctrine automatically creates the object. So for example the following code is possible:
When accessing one-to-many related records, Doctrine creates a Doctrine_Collection for the related component. Lets say we have users and phonenumbers and their relations is one-to-many. You can add phonenumbers easily as shown above: