Unclecheese,
The syntax for that is something like:
return $group->Spotlights("Status='valid'",null,null,1);
And again -- the same SortableDataObject bug. Below is the exception noting duplicate column:
[User Error] Couldn't run query: SELECT count(*) FROM SELECT "Spotlight"."ClassName", "Spotlight"."Created", "Spotlight"."LastEdited", "Spotlight"."Title", "Spotlight"."Caption", "Spotlight"."ExternalLink", "Spotlight"."Status", "Spotlight"."SortOrder", "Spotlight"."ThumbnailID", "Spotlight"."PosterImageID", "Spotlight"."MediaID", "Spotlight"."PageID", "Spotlight"."ID", CASE WHEN "Spotlight"."ClassName" IS NOT NULL THEN "Spotlight"."ClassName" ELSE 'Spotlight' END AS "RecordClassName", "SpotlightGroup_Spotlights"."SortOrder" FROM "Spotlight" INNER JOIN "SpotlightGroup_Spotlights" ON "SpotlightGroup_Spotlights"."SpotlightID" = "Spotlight"."ID" WHERE ("SpotlightGroup_Spotlights"."SpotlightGroupID" = 1) AND (Status='valid') GROUP BY "Spotlight"."ClassName", "Spotlight"."Created", "Spotlight"."LastEdited", "Spotlight"."Title", "Spotlight"."Caption", "Spotlight"."ExternalLink", "Spotlight"."Status", "Spotlight"."SortOrder", "Spotlight"."ThumbnailID", "Spotlight"."PosterImageID", "Spotlight"."MediaID", "Spotlight"."PageID", "Spotlight"."ID", CASE WHEN "Spotlight"."ClassName" IS NOT NULL THEN "Spotlight"."ClassName" ELSE 'Spotlight' END, "SpotlightGroup_Spotlights"."SortOrder") all_distinct Duplicate column name 'SortOrder'
Have you been able to repeat this? I'm having to use a inefficient workaround (below)
$groupSet = $group->getManyManyComponents("Spotlights","Status='valid'");
$mySet = new DataObjectSet();
$count = intval($group->Slots);
while($count && $groupSet->exists())
{
$count--;
$mySet->push($groupSet->shift());
}
return $mySet;