Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions

File data type cause error


Reply

3 Posts   423 Views

Avatar
imanovski

20 November 2012 at 7:02am Community Member, 3 Posts

Hi,

Forgive me if my problem are related to datamodel, but its hapen in DataObject child class. I using "file" type in my class. Its look like this :

class JakpusUpdate extends DataObject {

public static $db = array(
'InfoMsg' => 'Varchar(255)'
);

public static $has_one = array(
'InfoFile' => 'File',
'JakpusUpdateListPage' => 'JakpusUpdateListPage'
);

// Summary fields
public static $summary_fields = array(
'InfoMsg' => 'Info Update',
'InfoFile' => 'Gambar / Video',
'Created' => 'Dibuat'
);

public function getCMSFields_forPopup() {

$fileField = new UploadField('InfoFile', 'Gambar / Video');
$fileField->allowedExtensions = array('jpg','gif','png', 'flv');

// Name, Description and Website fields
return new FieldList(
new TextareaField('InfoMsg', 'Info Update'),
$fileField
);
}
}

Point on this code

public static $has_one = array(
'InfoFile' => 'File',
'JakpusUpdateListPage' => 'JakpusUpdateListPage'
);

Its give me Server Error page when I tried to accessed backend editor related to this class, its show like pic I've attached.

But if, change the code to this, the error not showup :

public static $has_one = array(
'InfoFile' => 'Image',
'JakpusUpdateListPage' => 'JakpusUpdateListPage'
);

I don't have any clue why this happen. Can anyone help me ?

thanks.

Avatar
kpolszewsk

19 December 2012 at 4:29am Community Member, 2 Posts

You should always show error message with "dev" environment turned on in order to receive any help, otherwise we won't have any clue what's going on.

Avatar
imanovski

19 December 2012 at 12:37pm Community Member, 3 Posts

Yeah, it is a dump mistake. I forgot to set the environment setting. I have solved this problem.

Case close.