The code works, but we eventually noticed, the the mystery of vanishing email-addresses was directly related to that code I wrote:
$bean->load_relationship('contacts');
foreach ($bean->contacts->getBeans() as $contact){
...
$contact->primary_address_street = $bean->billing_address_street;
...
$contact->save();
}
The intended changes appear, but all linked contacts lose their email addresses.
Any ideas on how to convince $contact->save() to indeed save everything?