I'm really frustrated with an issue I'm having; logically I think I have everything in order, so I'm puzzled with what I'm doing wrong, hopefully someone can help.
Here's the basic info. I have a page type called SaturdayPage, a page type called Faculty and a data object called course. The relationships are as follows:
A SaturdayPage has many Course and a Course belongs to many SaturdayPage
A Faculty has many Course and a Course has one Faculty
All the complex table fields work and the info seems to be stored properly in the DB. Where I run into trouble is when I try to use this simple function w/in Course.php:
function getFaculty() {
$obj = 'Faculty';
$sort = 'FirstName ASC';
$filter = 'Faculty', "`ID` = '{$this->FacultyID}'";
$join = '';
$limit = '';
$gf = DataObject::get($obj, $filter, $sort, $join, $limit);
return $gf;
}
In the database the FacultyID field is populated correctly, but this code renders nothing in the template. If I take out the $filter variable, I can populate all the Faculty objects. But even the simpliest of filters (ie "ID='1'";) breaks everything down, and I get an error.
Here is the code excerpt in the template (ScheduleHolder.ss)
<% control Children %>
<h2>$Header</h2>
<p>
<% if StartDate %>$StartDate.Format(m)/$StartDate.Format(d)/$StartDate.Format(y)<% end_if %>
<% if EndDate %> - $EndDate.Format(m)/$EndDate.Format(d)/$EndDate.Format(y)<% end_if %>
<% if SpecialComments %><br />$SpecialComments<% end_if %>
</p>
<% control Courses %>
$CourseTitle
<% control getFaculty %>
$Name
<% end_control %>
<% end_control %>
<% end_control %>
Please let me know any ideas you guys/gals may have. Also if it helps to show the pages and dataobject classes let me know.
Thanks in advance.