Hello there!
After a while of playing with your CMS I hit some problems. I'm trying to allow editing data stored in a separate dataobject through a certain page in the administration panel. Here's the code I've written:
OtherPage
<?php
class OtherPage extends Page {
static $db = array(
);
static $has_one = array(
'SomeData1' => 'OtherData',
'SomeData2' => 'OtherData',
'SomeData3' => 'OtherData',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Something', new TextareaField('SomeData1', '...'));
$fields->addFieldToTab('Root.Content.Something', new TextareaField('SomeData2', '...'));
$fields->addFieldToTab('Root.Content.Something', new TextareaField('SomeData3', '...'));
return $fields;
}
static $allowed_children = 'none';
}
class OtherPage_Controller extends Page_Controller {
}
OtherData
<?php
class OtherData extends DataObject {
static $db = array(
'SomeData1' => 'Text',
'SomeData2' => 'Text',
'SomeData3' => 'Text',
);
static $has_one = array(
'OtherPage' => 'OtherPage'
);
}
I believe there is missing some link that would connect the fields in OtherPage with corresponding fields in database managed by OtherData. The fields' content is persistently empty, even though I'm populating them with text. What am I doing wrong?
Thanks in advance.