Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » like tutorial 5, but with members

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1009 Views
  • lekoala
    Avatar
    Community Member
    30 Posts

    like tutorial 5, but with members Link to this post

    Hi all,

    I'm trying to do something similar to tutorial 5 but with members instead of students. The idea is to have an activitypage to which members can subscribe.

    The code so far looks like this :

    ***

    class ActivityPage extends Page {
       static $db = array(
          'Date' => 'Date',
          'HeureDebut' => 'Time',
          'HeureFin' => 'Time',
          'Lieu' => 'HTMLText',
          'Titre' => 'Varchar'
       );
       static $has_one = array(
          'Photo' => 'Image'   
    );
    static $has_many = array(
    'Participants' => 'Member'
    );
    static $defaults = array(
          'ShowInMenus' => false
       );

    function getCMSFields() {
    $fields = parent::getCMSFields();
       
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
       
        $fields->addFieldToTab( 'Root.Content.Main', new CalendarDateField( 'Date' ) );
    $fields->addFieldToTab( 'Root.Content.Main', new TimeField( 'HeureDebut' ) );
    $fields->addFieldToTab( 'Root.Content.Main', new TimeField( 'HeureFin' ) );
        $fields->addFieldToTab( 'Root.Content.Main', new TextField( 'Lieu' ) );
    $fields->addFieldToTab( 'Root.Content.Main', new TextField( 'Titre' ) );
       
        $tablefield = new HasManyComplexTableField(
    $this,
    'Participants',
    'Member',
    array(
        'FirstName' => 'Prénom',
        'Surname' => 'Nom',
    ),
    'getCMSFields_forPopup'
    );
    $tablefield->setAddTitle( 'Member' );

    $fields->addFieldToTab( 'Root.Content.Participants', $tablefield );
       
    return $fields;
    }

    }

    ***

    which is basically the same code that the one in the tutorial except that I have changed Students to Participants (the name) and Student to Member (the type)

    But... it crashes.

    FATAL ERROR: Missing argument 1 for DataObject::get(), called in E:\www\xemecercle\silverstripe\sapphire\core\ViewableData.php on line 99 and defined
    At line 1431 in E:\www\xemecercle\silverstripe\sapphire\core\model\DataObject.php

    Which argument for DataObject is missing ? Any hint is welcome!

    1009 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.