简单的例子

给出一个像这样简单的 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;
}