I am having some problems about event calendar module. I hope someone can help :)
I extended the Calendar class,
class ExhibitionHolder extends Calendar
{
static $has_many = array (
'ExhibitionPages' => 'ExhibitionPage'
);
}
and,
CalendarEvent class.
class ExhibitionPage extends CalendarEvent
{
static $has_many = array (
'ExhibitionDates' => 'ExhibitionDateTime'
);
}
In the ExhibitionHolder.ss I want to list 5 upcoming events if there are no dates clicked.
<% if Events %>
<% control Events %>
$_Dates $EventTitle $Link
<% end_control %>
<% else %>
<% control ExhibitionList %>
$Title <% control Dates %>$StartDate.Nice<% end_control %> <% control Dates %>$EndDate.Nice<% end_control %> $Link
<% end_control %>
<% end_if %>
The following function returns the list of all Exhibition Pages as expected. But I when I try to sort them using StartDate. I get error. When I use ID in the join, I get error 'Column 'ID' in on clause is ambiguous'. When I use ExhibitionPage.ID, I get error 'Unknown Column ExhibitionPage.ID'.
function ExhibitionList($num=5) {
return DataObject::get("ExhibitionPage", "", "CalendarDateTime.StartDate ASC", "LEFT JOIN CalendarDateTime ON CalendarDateTime.EventID = ID", $num);
}
Any help will be great.