Skip to content

Instantly share code, notes, and snippets.

@jrast
Created September 5, 2012 21:19
Show Gist options
  • Save jrast/3644953 to your computer and use it in GitHub Desktop.
Save jrast/3644953 to your computer and use it in GitHub Desktop.
Passing control down to component
<?php
class Calendar extends Page {
public static $has_many = array(
'Years' => 'Year'
);
}
class Calendar_Controller extends Page_Controller {
}
<?php
class Event extends DataObject {
public static $has_one = array(
'Year' => 'Calendar',
'EventPDF' => 'File'
);
}
class Event_Controller extends Controller {
}
<?php
class Year extends DataObject {
public static $has_one = array(
'Calendar' => 'Calendar',
'YearPDF' => 'File'
);
public static $has_many = array(
'Events' => 'Event'
);
}
class Year_Controller extends Controller {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment