Hi,
I am maintaining a large existing site and I am going to add create a new module to contain a new development.
I have a ComplexTable Field maintaining a dataobject called Tip. I have added some page types to the mysite code and tested my functionality. There are no problems there.
When I move the code to a new module in the root, everything looks the same until I come to save my page. I get no error returned but Silverstripe is no longer saving the dataobject relationship.
My page class looks as follows:
class FAQ extends Page {
static $db = array(
'RelatedFAQs' => 'HTMLText',
);
public static $has_one = array(
'MyTip' => 'Tip'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new HasOneComplexTableField(
$this,
'MyTip',
'Tip',
array(
'TipName' => 'Tip Name',
'TipContent' => 'Tip Content'
),
'getCMSFields_forPopup'
);
$tablefield->setParentClass('FAQ');
$fields->addFieldToTab( 'Root.Content.Tips', $tablefield );
$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('RelatedFAQs'));
return $fields;
}
}
My dataobject looks as follows:
class Tip extends DataObject {
public static $db = array(
'TipName' => 'Text',
'TipContent' => 'HTMLText'
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'TipName' ) );
$fields->push( new HTMLEditorField( 'TipContent' ) );
return $fields;
}
public static $has_many = array(
'FAQs' => 'FAQ'
);
}
Is this a known issue? Do I need to add anything in to my module config file? It is currently empty.
Thanks in advance!
Nick