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   457 Views

Avatar
imanovski

Community Member, 3 Posts

20 November 2012 at 7:02am

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

Community Member, 2 Posts

19 December 2012 at 4:29am

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

Community Member, 3 Posts

19 December 2012 at 12:37pm

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

Case close.