silverstripe/sapphire — pull request #1881 by wilr (2013-05-12 07:12:35+00:00)
Title:  API: Support $obj->HasOne = $record saving in ORM.

Fixes http://open.silverstripe.org/ticket/6475.

Rather than using $obj->HasOneID = $record->ID syntax this introduces another branch to DataObject::setField() which handles saving has_ones. Implemented tests to cover each behaviour types to ensure the internal components array is also updates.

Updated user documentation with information on how to set has_one relations and extended documentation on accessing relationships