Created
August 12, 2014 18:59
-
-
Save kiru/341d0e7761237b4a80ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ClassRoomAdmin extends ModelAdmin { | |
static $managed_models = array('ClassRoom'); | |
static $menu_title = 'ClassRoomAdmin'; | |
static $url_segment = 'classroom-admin'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ClassRoom extends DataObject { | |
static $db = array( | |
'Date' => 'Varchar', | |
); | |
static $has_many = array( | |
'Students' => 'Student', | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Student extends DataObject { | |
static $db = array( | |
'Name' => 'Varchar', | |
); | |
static $has_one = array( | |
'ClassRoom' => 'ClassRoom', | |
); | |
public function getCMSFields() { | |
$fieldList = parent::getCMSFields(); | |
$fieldList->push(new DropdownField('ClassRoomID', 'ClassRoom', ClassRoom::get()->map("ID"))); | |
return $fieldList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment