Silverstripe Version: 3.7.1
Question: re: I’m getting a SQL error when using GroupedList
This is the tip of my trace; the SQL error I get when trying to use the GroupedBy
function of GroupedList
DBConnector->databaseError(You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘AS “1” FROM “SupportService” WHERE (“SupportService”.“PageID” = ?)’ at line 1,256,SELECT DISTINCT AS “1” FROM “SupportService” WHERE (“SupportService”.“PageID” = ?),Array)
My controller function
public function Services()
{
$services = SupportService::get()->filter([
'PageID' => $this->ID
]);
return GroupedList::create($services);
}
My model defines a grouping function
public function getCategory()
{
return $this->getField('Category');
}
My view template
<% loop Services.GroupedBy(Category) %>
$Category
<% loop $Children %>
Foo
<% end_loop %>
<% end_loop %>
Any ideas?