Add lazy load fix

This commit is contained in:
micmania1 2013-08-23 16:22:13 +01:00
parent fbb372d1b9
commit 248c5189e3

View File

@ -29,4 +29,16 @@ class BlogPostFilter extends DataExtension {
}
/**
* This is a fix so that when we try to fetch subclasses of BlogPost,
* lazy loading includes the BlogPost table in its query. Leaving this table out
* means the default sort order column PublishDate causes an error.
**/
public function augmentLoadLazyFields(SQLQuery &$query, &$dataQuery, $parent) {
// Ensures that we're joining the BlogPost table which holds required db fields.
$dataQuery->innerJoin("BlogPost", "`SiteTree`.`ID` = `BlogPost`.`ID`");
}
}