I am trying to query the sitetree to return the Title entry of a specific classname "Discipline".
I'm trying to create a drop downfield for a search that will contain the Disciplines.
One of the examples specifically points out the map() function to do this as documented here http://doc.silverstripe.com/doku.php?id=sqlquery#mapping
I've created a function that will return an new search form under the
class TeacherHolder_Controller extends Page_Controller
As far as I can tell from the documentation I should be able to use DB:query.
$discipline = DB::query("Select Title FROM SiteTree_Live WHERE ClassName = 'Discipline' and ShowInMenus = 1 ORDER BY Sort ASC");
$map = $discipline->execute()->map();
or
$sqlQuery = new SQLQuery();
$sqlQuery->select = array('Title');
$sqlQuery->from = 'SiteTree';
$sqlQuery->where = 'ClassName = "Discipline"';
$sqlQuery->orderby = 'Sort ASC';
$map = $sqlQuery->execute()->map();
and then the dropdown creation.
new DropdownField("Discipline", "Discipline",$map);
When I post either of those codes to the server I receive this error:
Error
The website server has not been able to respond to your request.
Can anyone shed some light on what I may have done incorrectly. Thanks.