Hi,
I recently upgraded my Blog module from v0.1 to v0.4 and I'm seeing some problems. Previously I had modified the function Entries() to include a LET JOIN on the File table so that I can get a listing image field that I added to BlogEntry and that I use on the front end. This function used to be in BlogHolder, and now lives in a new class BlogTree. Regardless, however, as soon as I add in my Join:
return DataObject::get('BlogEntry', $filter, $order, 'LEFT JOIN File ON BlogEntry.ListingImageID = File.ID', $limit);
I get Database errors. Specifically, "Column 'ParentID' in where clause is ambiguous". But this isn't even the part of the SQL query to which I have access, so i don't really know how to debug this. Here's the whole error:
[User Error] Couldn't run query: SELECT "SiteTree_Live"."ClassName", "SiteTree_Live"."Created", "SiteTree_Live"."LastEdited", "SiteTree_Live"."URLSegment", "SiteTree_Live"."Title", "SiteTree_Live"."MenuTitle", "SiteTree_Live"."Content", "SiteTree_Live"."MetaTitle", "SiteTree_Live"."MetaDescription", "SiteTree_Live"."MetaKeywords", "SiteTree_Live"."ExtraMeta", "SiteTree_Live"."ShowInMenus", "SiteTree_Live"."ShowInSearch", "SiteTree_Live"."HomepageForDomain", "SiteTree_Live"."ProvideComments", "SiteTree_Live"."Sort", "SiteTree_Live"."HasBrokenFile", "SiteTree_Live"."HasBrokenLink", "SiteTree_Live"."Status", "SiteTree_Live"."ReportClass", "SiteTree_Live"."CanViewType", "SiteTree_Live"."CanEditType", "SiteTree_Live"."ToDo", "SiteTree_Live"."Version", "SiteTree_Live"."ParentID", "Page_Live"."Headline", "BlogEntry_Live"."Date", "BlogEntry_Live"."Author", "BlogEntry_Live"."Tags", "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName" FROM "SiteTree_Live" LEFT JOIN "Page_Live" ON "Page_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "BlogEntry_Live" ON "BlogEntry_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN File ON BlogEntry.ListingImageID = File.ID WHERE ("SiteTree_Live"."ClassName" IN ('BlogEntry')) AND ("ParentID" IN (576) ) GROUP BY "SiteTree_Live"."ClassName", "SiteTree_Live"."Created", "SiteTree_Live"."LastEdited", "SiteTree_Live"."URLSegment", "SiteTree_Live"."Title", "SiteTree_Live"."MenuTitle", "SiteTree_Live"."Content", "SiteTree_Live"."MetaTitle", "SiteTree_Live"."MetaDescription", "SiteTree_Live"."MetaKeywords", "SiteTree_Live"."ExtraMeta", "SiteTree_Live"."ShowInMenus", "SiteTree_Live"."ShowInSearch", "SiteTree_Live"."HomepageForDomain", "SiteTree_Live"."ProvideComments", "SiteTree_Live"."Sort", "SiteTree_Live"."HasBrokenFile", "SiteTree_Live"."HasBrokenLink", "SiteTree_Live"."Status", "SiteTree_Live"."ReportClass", "SiteTree_Live"."CanViewType", "SiteTree_Live"."CanEditType", "SiteTree_Live"."ToDo", "SiteTree_Live"."Version", "SiteTree_Live"."ParentID", "Page_Live"."Headline", "BlogEntry_Live"."Date", "BlogEntry_Live"."Author", "BlogEntry_Live"."Tags", "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END ORDER BY "BlogEntry_Live"."Date" DESC LIMIT 0,32 Column 'ParentID' in where clause is ambiguous
Anyone else able to successfully add a JOIN to this DataObject::get()?
Thanks,
Garrett