Hi
Let me start with my code
public static $belongs_to = array(
'Event' => 'Event',
'Team' => 'Team'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root.Content.Main', 'MenuTitle');
$fields->removeFieldFromTab('Root.Content.Main', 'Title');
$fields->removeFieldFromTab('Root.Content.Main', 'Content');
$EventID = DataObject::get_by_id('Event',$this->EventID);
$oData = (DataObject::get('Team','`Event_Teams`.EventID =' + $EventID,'','LEFT JOIN `Event_Teams` ON `Event_Teams`.TeamID=`Team`.ID ',''));
if ($oData) {
$CategoriesSource = $oData->toDropDownMap('ID','Name');
} else {
// no categories there yet, might put a literalfield to tell the user
}
What I am trying to do here is pass the EventID to the filter so I only see teams that are entered into the Event (by filter by eventID and then joining teams in the Event_teams table).
However I get an error that EventID is null... (or to that effect)... I am not sure how to correctly reference EventID so that I get the current event thats selected in the CMS...
Any ideas?
Thanks