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.

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

A simple Question? Started a New Post !!

Go to End

3 Posts   1000 Views


Community Member, 110 Posts

10 November 2009 at 7:06am

Edited: 14/11/2009 3:17am

Okay, so i already have a SS site up and running. It's ideal for a rather basic website but...

Now i want to take it to the next step and i'm totally lost. I've been playing with Tutorial 5 and it works great but it's to complex for what i want and i don't know how to 'rip' it. I've been playing with ModelAdmin as well but i guess i could use some more documentation on that.

Here's what i want. A TVserie database.

- A serie has Several seasons (1-to many ?)
- A Season has several episodes (1 - to many ?)
- An episode has 1 serie and 1 season ( or is this not nessasary?)

So i want to select a serie -> go to the seriepage -> choose the season -> get a list of episodes

I did make the seriepage ,seasonpage and episodepage resulting in 3 tables

class SerieAdmin extends ModelAdmin {

public static $managed_models = array(

static $url_segment = 'series';
static $menu_title = 'My Serie Admin';

class Serie extends DataObject {
static $db = array(
'Title' => 'Varchar'

static $has_many = array(
'Seasons' => 'Season',


class Season extends DataObject {

static $has_one = array(
'Serie' => 'Serie'
static $has_many = array(
'Episodes' => 'Episode'

static $db = array(
'Name' => 'Varchar',


class Episode extends DataObject {

static $has_one = array(
'Season' => 'Season'

static $db = array(
'Name' => 'Varchar'


But now i'm totally lost, where to go now to display it all the way i want.???


Community Member, 110 Posts

11 November 2009 at 3:49am

Edited: 11/11/2009 9:49pm

Okay, in fact it kinda works...
I have my 3 Tabs Serie,Season and Episode
I create a Serie - no problem
i create a Season ; i can choose the serie i want to create it for, no problem
i create an episode; i choose the serie it's for and then i choose the season.....ahhhh

The problem now is that every serie has several seasons, but they are all called Season 01, Season 02 etc.
So when i create an Episode and want to choose the Season i get a list of all seasons ( meaning, several seasons 01, several seasons 02 etc) So i'll never know if i choose the right season.


I've taken a slightly different approach...

I removed the 'Season' DataObject and made it a 'Enum' value in the 'Episode' DataObject since the values are the same for every 'Serie'. So the 'Season' table is gone, and now i have a Season dropdownfield in the Episode Tab.

<end of Update>

Then there is the display issue...
I did use the genericview module but it just gives me a list of the series (that's what i chose in the collectors tab), it doesn't link to a page with the seasons/episodes.

I made a seperate page where i used return DataObject::get('serie'), but that also just gives me a webpage with a list of all my series. Still not linking to a page with the corresponding seasons...

Can somebody please help me out here?


Community Member, 110 Posts

11 November 2009 at 9:45pm

Edited: 11/11/2009 10:00pm

I made a TVSerieHolder, and ChildrenPages 'TVSerie'.
So now when i create a TVSerie page for every Serie i can actually navigate to the corresponding Seriepage (well after all that's the whole point of having a CMS, right?).

But how do i tell this page to only show the corresponding Episodes? Because now it shows all Episodes
( function EpisodeList(){return DataObject::get('Episode'); } ) How do i use some kind of filtering?

This is what i want;

X-Files ---go to the X-Files Pages (Works)
IF (X-Files has more than one Season)
Show Seasons (Then let me choose which season i want to see the episodes for)
ELSE (show all Season 01 Episodes)

I think i need to use something with $this but i can't figure it out.