Im using the Link class in an extended DataObject as $has_one
. But when i save my Object the Link value is lost.
<?php
class Teaser extends DataObject {
private static $db = array (
'Title' => 'Varchar',
'Description' => 'HTMLText'
);
private static $has_one = array (
'Photo' => 'Image',
'MyLink' => 'Link'
);
private static $many_many = array(
'Tags' => 'Tag'
);
private static $summary_fields = array (
// ...
);
public function getCMSFields() {
$fields = FieldList::create(
TextField::create('Title'),
$tags = TagField::create('Tags','Tags',Tag::get(),$this->Tags()),
HTMLEditorField::create('Description', 'Beschreibung'),
LinkField::create('MyLink', 'Weiterleitung', $this->MyLink()),
$uploader = UploadField::create('Photo')
);
// ...
return $fields;
}
}
i tried the example in a Page and it works but in the DataObject i cant save the value.