Jump to:

3373 Posts in 998 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » File data type cause error

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 355 Views
  • imanovski
    Avatar
    Community Member
    3 Posts

    File data type cause error Link to this post

    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.

  • kpolszewsk
    Avatar
    Community Member
    2 Posts

    Re: File data type cause error Link to this post

    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.

  • imanovski
    Avatar
    Community Member
    3 Posts

    Re: File data type cause error Link to this post

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

    Case close.

    355 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.