Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Extending Dataobjects and managing them via model admin?


Go to End


2 Posts   1094 Views

Avatar
mayko80

Community Member, 2 Posts

14 April 2016 at 11:59am

Heyho,

I've got a base DataObject called "team" and would like to create 2 sub classes of this DataObject called "rugbyTeam" and "cricketTeam".
In the CMS model admin I would like to edit these sub DataObjects.

I've read that you can create DataExtensions but those are not manageable via ModelAdmin.

Any ideas?

Cheers

Avatar
camfindlay

Forum Moderator, 267 Posts

15 April 2016 at 1:38pm

Ideally, you should call them RugbyTeam and CricketTeam (note the upper camelcase, just a convention thing).

That aside, you could manage these two model in different tabs in a single module admin.
Example:

<?php
class TeamAdmin extends ModelAdmin {
    private static $managed_models = array(
        'RugbyTeam',
        'CricketTeam',
    );
    private static $url_segment = 'teams';
    private static $menu_title = 'Teams';
}