簡單的例子
給出一個像這樣簡單的 DataObject
:
class MyDataObject extends DataObject {
private static $db = array(
'Name' => 'Varchar(255)'
);
}
要為物件提供完整的 Create-Read-Update-Delete,那麼這是所需的 ModelAdmin
程式碼:
class MyModelAdmin extends ModelAdmin {
private static $mangaged_models = array(
'MyDataObject'
);
private static $url_segment = 'my-model-admin';
private static $menu_title = 'My Model Admin';
private static $menu_icon = 'mysite/images/treeicons/my-model-admin.png';
private static $menu_priority = 9;
}