I'm trying to add an UploadField to to a PageType to store a related File. Obviously doing something stupid, but what :(
use SilverStripe\Assets\File;
use SilverStripe\AssetAdmin\Forms\UploadField;
class FilePage extends Page
{
private static $has_one = array(
"FileObject" => "File"
);
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main',
UploadField::create('FileObject', 'My File')
);
return $fields;
}
Generates: Uncaught InvalidArgumentException: has_one relation FilePage.FileObject references class File which doesn't exist.
Same happens with Image. Although both classes exist in the given namespace...