With this code the DataObject ID (InternalExternalLinkID) is not saved to the page when the CMS page is published, how to I automatically add the scaffolding from the dataobject and have the relationship saved (without manually doing onAfterWrite() as described at http://www.silverstripe.org/data-model-questions/show/11044):
class Page extends SiteTree {
private static $has_one = array(
'InternalExternalLink' => 'InternalExternalLink'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Main', singleton('InternalExternalLink')->getCMSFields());
I understand you probably need to create the dataobject first, get the ID and then save to the Page object - can the CMS not do this scaffolding, create (or update) and save this related dataobject automatically like ModelAdmin does?